I have written a shell
script to start mysql server & send a mail to admin user if it's restarted via shell
script. What i am facing an issue if I run this shell
script on terminal it's work perfectly & If same script runs via cronjob it's only sending the mail to the user & problem remains same. Is this problem relates to permission & how can i resolve it.
if ps ax | grep -v grep | grep $SERVICE > /dev/null
echo "$SERVICE service running, everything is fine"
echo "$SERVICE is not running"
cat <<EOF | msmtp -a gmail $EMAIL
Subject: "Alert (Test Server) : Mysql Service is not running (Manually Restarted)"
Mysql Server Restarted at: `date`
I am using msmtp for sending mail to the user on ubuntu 12.04 Server.