I have a shell script that checks every 5 minutes (using cron) to see if MySQL is running. If it isn't running the shell script starts MySQL. This all works properly. However I want to have a PHP script e-mail me when the restart takes place, the PHP script is being executed using lynx. I can get the shell script and PHP to run properly without using crontab. If I run the shell script /path/to/script/sqlcheck.sh from SSH it works perfectly. Any ideas why crontab will not run the PHP script within the shell script?
My Crontab is:
5,10,15,20,25,30,35,40,45,50,55 /path/to/script/sqlcheck.sh
The Shell Script is:
#!/bin/sh
VARIABLES
HOME=/home/sites/site64/mysql
PID=$HOME/mysql.pid
SQLCMD=$HOME/support-files/mysql.server
if [ -x $SQLCMD ]
then
if [ ! -f $PID ]
then
/usr/bin/lynx -dump http://www.apcon.com/php/sqlcheckmail.php
$SQLCMD start
fi
else
echo ""
echo "$SQLCMD not found."
echo "Aborting."
echo ""
fi