Page 1 of 1

./DriveTempShutdown.sh: -ge: unary operator expected !!!

Posted: May 30th, 2013, 3:37 am
by danhansen@denmark
Hello friends ;)

My system is Ubuntu Server 12.04.2 / ISPConfig 3 v.3.0.5.2 / Older Computer P4 2.4GHz, 2Gb RAM

1.
Had this same error when I was editing/running the CPUTempShutdown.sh script...
It's just that "Ian" solved this problem very nicely, it was a GRUB-thing... But now the error is back, I guess it's the same thing, but not quite the same as we corrected the problem allready..

Here's the error message:

Testing Drive sda
./DriveTempShutdown.sh: line 68: [: -ge: unary operator expected
./DriveTempShutdown.sh: line 79: [: -ge: unary operator expected



Here's the full error message:

./DriveTempShutdown.sh 20 60

JOB RUN AT Thu May 30 03:51:19 CEST 2013
=============================================

Drive Warning Limit set to => 20
Drive Shutdown Limit set to => 60

Testing all drives

Drive /dev/sda

Testing Drive sda
./DriveTempShutdown.sh: line 68: [: -ge: unary operator expected
./DriveTempShutdown.sh: line 79: [: -ge: unary operator expected
Temperature of Drive a is OK at =>

All Drives are within limits


2.
# Change the command MyList='a b c d e' to the number of drives you have. In this case I'm using 6 drives
a. If there's 6 drives how come there's only 5 letters? Isn't the first device/hd hda? I'm asking because I'm pretty much a beginner in the Linux Universe...
b. do you have to change it (above) if you use the 3 argument when running the script e.g. "./DriveTempShutdown.sh 30 60 a" ???

3.
# Substitute string "myemail@myaddress.com" with your own email address in the string which starts "/usr/sbin/ssmtp myemail@myaddress.com"
a. I'm told that with the Ubuntu Server 12.04.2 - ISPConfig 3 you'll have to use "sendmail" - any suggestion to how the code could look like? Path & Command?!?


Hope you can help me out, again ;)

Kind Regards,
Dan Hansen / Denmark

Re: ./DriveTempShutdown.sh: -ge: unary operator expected !!

Posted: May 30th, 2013, 11:03 pm
by Ian
Hi Dan,

Re your unary operator expected error. Paste the following two lines of code into that script after the str2=$($str1 | grep Temperature_Celsius | awk '{print $10}') command which is line 66 in the script. Then run the command again and post the output in your next post

Code: Select all

echo $str1
echo $str2


Re the MyList='a b c d e', yes that would only test 5 drives. Add an f to test 6. Good spot.
If you add the 3rd argument you don't need to change the list, just specify the drive "letter" you want to test, or omit it completely to test all of them.

I'll have to get back to you on the sendmail, I'm not using 12.04. Sorry.

Ian.