crontab führt script falsch aus.
Posted: 2008-07-21 23:47
				
				Hallo Leute
ich habe folgendes Script in crontab von root aufgenommen um die temp. meiner Platten im Auge zu behalten. (jede min. ist nur zum test so eingestellt)
Wenn ich das script normal ausführe dann kommt eine email mit diesem Inhalt an:
On Di 22. Jul 07:19:03 CEST 2008 the device: /dev/sda on fileserver had a normal temerature of 37 celcius. That is OK :)
wenn es von crontab ausgeführt wird FEHLT die $VALUETEMP Variable in der email.
On Di 22. Jul 07:18:01 CEST 2008 the device: /dev/sda on fileserver had a normal temerature of celcius. That is OK :)
Wieso?? danke für eure Tips. :)
			ich habe folgendes Script in crontab von root aufgenommen um die temp. meiner Platten im Auge zu behalten. (jede min. ist nur zum test so eingestellt)
Code: Select all
    #!/bin/sh
    DEVICE="/dev/sda"
    MACHINE="fileserver"
    TEMPLIMIT=50
    DATE=$(date)
    VALUETEMP=$(hddtemp -n $DEVICE)
    #MAILTXT=""
    if [ "$VALUETEMP" -gt "$TEMPLIMIT" ]; then
        MAILTXT=${MAILTXT}"On ${DATE} the device: $DEVICE on $MACHINE got hotter than ${TEMPLIMIT} celcius. ${VALUETEMP} is TOO HOT !! Do something about it!!"
        echo $MAILTXT | mail -s "HARDDRIVE on ${MACHINE} too HOT!! It has ${VALUETEMP} celcius" kai@poeritz.de
    else
        MAILTXT=${MAILTXT}"On ${DATE} the device: $DEVICE on $MACHINE had a normal temerature of ${VALUETEMP} celcius. That is OK :)"
        echo $MAILTXT | mail -s "harddrive temperature on ${MACHINE} ok :)" kai@poeritz.de
    fi
Wenn ich das script normal ausführe dann kommt eine email mit diesem Inhalt an:
On Di 22. Jul 07:19:03 CEST 2008 the device: /dev/sda on fileserver had a normal temerature of 37 celcius. That is OK :)
wenn es von crontab ausgeführt wird FEHLT die $VALUETEMP Variable in der email.
On Di 22. Jul 07:18:01 CEST 2008 the device: /dev/sda on fileserver had a normal temerature of celcius. That is OK :)
Wieso?? danke für eure Tips. :)