Hi, I want to write about Cpu Temperature Alarm System I have done by using advantages of linux kernel and linux shell. (I used bash shell in my script by the way.)
One of the biggest advantages of linux is to reach hardware components easily through kernel. The communication with hardware comes true as given in the following steps:
1. User writes his/her request as codes.
2. Shell converts these codes to be understand by kernel.
3. Kernel is a gui which can thought as an interface between hardware and shell. Kernel sends these requests to hardware components.
You can understand these simple steps and more from the following scheme:
I wrote down the following script which can control cpu temperature and if it is out of the condition I have determined, it plays an alarm.
The comments about the script are given in the following step by step:
1. I used acpi package to get temperature of cpu from sensors. Info: acpi - Shows battery status and other ACPI information
2. To edit the output of acpi -t command and get the cpu temperature only, I used gawk package. Info: gawk - pattern scanning and processing language
3. I wrote the cpu temperature with echo
4. I used an if-else-fi block for control part.
5. If it is lower than 90 C, I wrote down the message: "no dangere."
6. If it is higher than 90 C, I wrote down the message: "cpu is in dangere!" and play the alarm.
If you like this article, use the share buttons below to help my blog.
If you have any question or need some help, leave a comment below.
SPONSOR
-->
No comments:
Post a Comment