Cron Job
I have created a cron. I used the crontab -e comand. Here is the actual crontab -e
* * * * * /etc/asterisk/chk_asterisk.sh >> /var/log/monitoring/cron/log.txt
here is my chk_asterisk.sh
#!/bin/sh
####################################
# Checking Asterisk Application #
#####################################
for abc in `ps -ef | grep -c asterisk` ; do
if [ "$abc" -eq 0 ] ; then
echo "The asterisk is not running" > /var/log/monitoring/asterisk/cron/down.txt
exit
fi
done
I tried invoking it manually to test the script and it worked. It created some logs from the directory specified above. Bt when I have added it use the crontab -e and inserted it on, the script fails.
Hope someone could he me on this.
Thanks.
Regards
Newbie_adm
|