I am automating backup of mysql using mysqldump, on linux. I will run the script from cron. I need a way to find out if the command has succeeded or failed. For example when I had corrupted tables the mysql dump was not backing up database and I did not know about it
I am using php to execute linux commans, so the script is PHP but command as shell, so in essence it is shell script
$command= '/usr/bin/mysqldump --add-drop-table -h localhost -u agir2 -ppassword agir2 > '.$sql_dump_file.' > '.$errorlog.' 2>&1'the problem with above code it that it does report error on failure, but on success it outputs whole database in to log file.I am happy to rewrite above or just use bash script.