[prog] Bash script problem
Noir
acknak_halflife at yahoo.co.uk
Sat Jan 21 14:36:16 EST 2006
I have got a script which is not doing what it's
supposed to do.
In short, the script should grep the output of a
program, awk for one column & send an email to me if
anything from that column matches my criteria.
#!/bin/bash
BINARY="/usr/sbin/binary"
MAIL="/bin/mail"
RECPT="acknak_halflife at yahoo.co.uk"
SUB1="Number does match for `hostname`"
SUB2="Number doesn't match for `hostname`"
ERROR_VALUE="No Matching ID Found"
# grep for specific column
PROG1="`$BINARY -l | grep -n 1 | awk {'print $7'}`"
# mail me to let me know that it is not working
PROG_ERR="`$BINARY -l | $MAIL -s "$SUB2" $RECPT`"
# mail me to let me know that it is working
PROG_OK="`$BINARY -l | $MAIL -s "$SUB1" $RECPT`"
# the total outout
PROG3="`$BINARY -l`"
# conditions
if [ "$PROG1" = "0.00" ] || [ "$PROG1" -gt "1000" ]
|| [ "$PROG" = "1000" ]; then
echo $PROG_ERR
elif [ "$PROG3" == "$ERROR_VALUE" ]; then
echo $PROG_ERR
else
echo $PROG_OK
fi
Any kind of help would be appreciated.
___________________________________________________________
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com
More information about the Programming
mailing list