I am using mysqldump to take the backup of my mysql database and have put it under a cron job . I want to test its success or failure and want it to echo the Success or Failure Message in the cron job email but failing ? Please help me out...
What command to pass ? I did this but failed :
In my php backup script I included:
$testvar = '
if [ "$?" -eq 0 ]
then
echo "Success"
else
echo "Mysqldump encountered a problem look in database.err for information"
fi
';
exec($testvar);
My server says : Unexpected End of File
SCRIPT:
$creatBackup = 'mysqldump -uabc -p password mydb > myfile '.
'if [ "$?" -eq 0 ]; then
eho "Success"
else echo "Mysqldump encountered a problem"
fi
';
$BackupMessage = exec($creatBackup);
echo $BackupMessage;