title: MySqldump success or failure test
body: <p>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...</p>
  
  <p>What command to pass ? I did this but failed : </p>
  
  <p>In my php backup script I included: </p>
  
  <pre><code>   $testvar = '
              if [ "$?" -eq 0 ]
  then
          echo "Success"
          else
          echo "Mysqldump encountered a problem look in database.err for information"
          fi
              ';
  
      exec($testvar);
  </code></pre>
  
  <p>My server says : Unexpected End of File</p>
  
  <p>SCRIPT:</p>
  
  <pre><code> $creatBackup = 'mysqldump -uabc -p password  mydb &gt; myfile '.       
          'if [ "$?" -eq 0 ]; then
          eho "Success"    
  
   else  echo "Mysqldump encountered a problem"
  fi
      ';
  
  
  
  $BackupMessage = exec($creatBackup);
  
  echo $BackupMessage;
  </code></pre>