Skip to content

Instantly share code, notes, and snippets.

@dionedomingo
Last active August 12, 2020 15:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dionedomingo/107b891f9c110b02b0d129255d1cd75c to your computer and use it in GitHub Desktop.
Save dionedomingo/107b891f9c110b02b0d129255d1cd75c to your computer and use it in GitHub Desktop.
<?php
$filename='database_backup_'.date('G_a_m_d_y').'.sql';
$result=exec('mysqldump database_name --password=your_pass --user=root --single-transaction >/var/backups/'.$filename,$output);
if($output==''){
echo "done";
/* no output is good */
}
else {
echo "something went wrong";
echo $output;
/* we have something to log the output here*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment