Sponsored Content
Full Discussion: Test temperature and alert
Top Forums Shell Programming and Scripting Test temperature and alert Post 303023737 by drysdalk on Friday 21st of September 2018 10:35:09 AM
Old 09-21-2018
Hi,

I'd just included that as a demonstration of how if works, really, so you could get an idea of what you need to do in your own code. So rather than directly using my example script, you'd adapt it and write your own if statement in your script to test the value of your temperature variable, after your script had set it.

So looking at your provided code, your could write an if statement at the end to test the value of the tc variable (assuming that's correct, and it does contain just a single integer that is the number you want to test). If the variable tc isnt' the right one then you'd use whatever variable contains the CPU temperature as an integer, and do the if tests on that.

If that doesn't work then if you can provide an example of the code you've written and what goes wrong when you run it, I'd be happy to help further in debugging and we can take things from there.
 

9 More Discussions You Might Find Interesting

1. HP-UX

temperature records

I'm fairly new to hpux, so this is what i've been trying to figure out. Is it possible to get any logs on hpux that would indicate if the system, cpu, or other hardware components reached above normal or critical temperatures? Thanks, -K (0 Replies)
Discussion started by: uzerx
0 Replies

2. SCO

temperature monitor

Is there command in sco unixware 7.1.3 from which i can find the temperature of the system/hardware. Something equivalent to prtdiag in solaris maybe thanks (1 Reply)
Discussion started by: gsb81
1 Replies

3. Solaris

CPU temperature

Hi all I have a SUN V480 server with 4 processores and I've noticed that the temperature for 2 of the 4 processers are quite high (63 degrees Celsius). Does anyone know what the operating temperatures of the Sparc CPU's are? I'm not getting any warning messages yet, but I want to resolve the... (3 Replies)
Discussion started by: soliberus
3 Replies

4. Filesystems, Disks and Memory

Hard Drive Temperature?

Hi, I just set up a raid Z array in solaris xpress and I notice that the drives feel pretty damn hot. I use speedfan to monitor the temperatures of the hard drives in XP. Is there a similar program for solrais? I assume there would be since the drives all have temp sensors in them, but I... (2 Replies)
Discussion started by: ciscocbee
2 Replies

5. Shell Programming and Scripting

Test on string containing spacewhile test 1 -eq 1 do read a $a if test $a = quitC then break fi d

This is the code: while test 1 -eq 1 do read a $a if test $a = stop then break fi done I read a command on every loop an execute it. I check if the string equals the word stop to end the loop,but it say that I gave too many arguments to test. For example echo hello. Now the... (1 Reply)
Discussion started by: Max89
1 Replies

6. Solaris

CPU Temperature Details

How to get a CPU temperature and current power consumption in T5220 server both from system controller and Operating system. I need details by cores. Thanks in advance. (13 Replies)
Discussion started by: fugitive
13 Replies

7. UNIX for Dummies Questions & Answers

MAKING A SCRIPT FOR TEMPERATURE

People hello to everybody exist a way to do a script for view the temperature. I have Red Hat Linux release 9 (Shrike) Kernel 2.4.20-8 on an i686 THANk YOU FOR YOUR TIME. (4 Replies)
Discussion started by: enkei17
4 Replies

8. Shell Programming and Scripting

How to check weather a string is like test* or test* ot *test* in if condition

How to check weather a string is like test* or test* ot *test* in if condition (5 Replies)
Discussion started by: johnjerome
5 Replies

9. Solaris

reading temperature again and ipmitool

some say '/usr/sfw/bin/ipmitool' can be used to read temperature. has anyone tried it? what options should be used? (1 Reply)
Discussion started by: orange47
1 Replies
FANCONTROL(8)						      System Manager's Manual						     FANCONTROL(8)

NAME
fancontrol - automated software based fan speed regulation SYNOPSIS
fancontrol [configfile] DESCRIPTION
fancontrol is a shell script for use with lm_sensors. It reads its configuration from a file, then calculates fan speeds from temperatures and sets the corresponding PWM outputs to the computed values. WARNING
Please be careful when using the fan control features of your mainboard, in addition to the risk of burning your CPU, at higher tempera- tures there will be a higher wearout of your other hardware components, too. So if you plan to use these components in 50 years, maybe you shouldn't use fancontrol at all. Also please keep in mind most fans aren't designed to be powered by a PWMed voltage. In practice it doesn't seem to be a major issue, the fans will get slightly warmer, just be sure to have a temperature alarm and/or shut- down call, in case some fan fails, because you probably won't hear it anymore ;) CONFIGURATION
For easy configuration, there's a script named pwmconfig(8) which lets you interactively write your configuration file for fancontrol. Alternatively you can write this file yourself using the information from this manpage. Since most of you are going to use pwmconfig(8) script, the config file syntax will be discussed last. First I'm going to describe the var- ious variables available for changing fancontrol's behaviour: INTERVAL This variable defines at which interval in seconds the main loop of fancontrol will be executed DEVPATH Maps hwmon class devices to physical devices. This lets fancontrol check that the configuration file is still up-to-date. DEVNAME Records hwmon class device names. This lets fancontrol check that the configuration file is still up-to-date. FCTEMPS Maps PWM outputs to temperature sensors so fancontrol knows which temperature sensors should be used for calculation of new values for the corresponding PWM outputs. FCFANS Records the association between a PWM output and a fan input. Then fancontrol can check the fan speed and restart it if it stops unexpectedly. MINTEMP The temperature below which the fan gets switched to minimum speed. MAXTEMP The temperature over which the fan gets switched to maximum speed. MINSTART Sets the minimum speed at which the fan begins spinning. You should use a safe value to be sure it works, even when the fan gets old. MINSTOP The minimum speed at which the fan still spins. Use a safe value here, too. MINPWM The PWM value to use when the temperature is below MINTEMP. Typically, this will be either 0 if it is OK for the fan to plain stop, or the same value as MINSTOP if you don't want the fan to ever stop. If this value isn't defined, it defaults to 0 (stopped fan). MAXPWM The PWM value to use when the temperature is over MAXTEMP. If this value isn't defined, it defaults to 255 (full speed). The configuration file format is a bit strange: VARIABLE=chip/pwmdev=value chip/pwmdev2=value2 VARIABLE2=... Each variable has its own line. The variable name is followed by an equal sign and the device=value pairs. These consist of the path to the pwm output for which the value is valid, equal sign followed by the value and are separated by a blank. Path can be absolute or relative (from /sys/bus/i2c/devices or /sys/class/hwmon depending on the kernel version). Example: MINTEMP=hwmon0/device/pwm1=40 hwmon0/device/pwm2=54 You have to play with the temperature values a bit to get happy. For initial setup I recommend using the pwmconfig script. Small changes can be made by editing the config file directly following the rules above. Upon starting, fancontrol will make sure that all referenced devices do exist and match what they were at configuration time, and that all referenced sysfs files do exist. If not, it will quit immediately, upon the assumption that the configuration file may be out-of-sync with the loaded kernel drivers. THE ALGORITHM
fancontrol first reads its configuration, writes it to arrays and loops its main function. This function gets the temperatures and fanspeeds from kernel driver files and calculates new speeds depending on temperature changes, but only if the temp is between MINTEMP and MAXTEMP. After that, the new values are written to the PWM outputs. Currently the speed increases quadratically with rising temperature. This way you won't hear your fans most of the time at best. SEE ALSO
pwmconfig(8), sensors(1). AUTHOR
Marius Reiner <marius.reiner@hdev.de> lm-sensors 3 September 2009 FANCONTROL(8)
All times are GMT -4. The time now is 03:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy