View Single Post
Posts: 539 | Thanked: 165 times | Joined on Feb 2010 @ Berlin, Germany
#454
Originally Posted by geojoking View Post
Also, I think the script itself has some problems because if I run it in terminal I get several "if" bugs and "sleep 100" and "sleep 10" erors.
First you should make sure the script is working correctly before trying to use it with some automated trigger like alarmed. In worst case you could shred your device this way if the script runs wild and gets started over and over again.

Then you should append the actual error messages to your post so one could help you on the point instead of guessing. Therefore all following hints are just guessed and might be wrong too.

Code:
#!/bin/sh
if [ `route | awk '/au/ {print $1}'` = default ]; then
Error #1: You are using an assignement instead of an equality testing operator just as if you'd try to assign the value "default" to the variable " `route | awk '/au/ {print $1}'` ". You should instead use '==' to test equality of output and string.
Error #2: all strings have to be enclosed by quotation marks. All not-enclosed values are treated as numbers which will obviously fail in this case.
Code:
if [ `ifconfig gprs0 | awk -F " " '/s0/ {print $2}'` = Link ]; then
Same as above.

What errors do you get concerning "sleep" command? Something like "command not found"?