Hi,
First time shell scripting, so I'm just trying to get by with man pages and the sticky in this forum.
This is the output of the following command:
Code:
VIC_DAS36 (root): /home/tsioper/status 2>/dev/null | grep CAL-SERVER2 | awk '{ print $5 }'
Serving
and this is the script I'm trying to create:
Code:
CAL-2=`/home/tsioper/status 2>/dev/null | grep CAL-SERVER2 | awk '{ print $5 }'`
CAL-4=`/home/tsioper/status 2>/dev/null | grep CAL-SERVER4 | awk '{ print $5 }'`
if [ '$CAL-2' = 'Stopped' ]
then
echo CAL Server 2 has gone down and/or stopped serving! | mail -s "WARNING: CAL Server" fake@email.com
elif
if [ '$CAL-4' = 'Stopped' ]
then
echo CAL Server 4 has gone down and/or stopped serving! | mail -s "WARNING: CAL Server" fake@email.com
fi
Now what I want the script to do is e-mail me when the output of the command is 'Stopped'.
This is what I get when I try running it:
Code:
VIC_DAS36 (root): ./CAL-test ./CAL-test[7]: CAL-2=Serving: not found.
./CAL-test[8]: CAL-4=Serving: not found.
./CAL-test[10]: 0403-057 Syntax error at line 13 : `if' is not matched.
Any input is accreciated
-Kristijan