Quote:
Originally Posted by Natch
One suggestion as an improvement ...
Include the facility to make this script also tar.gz the resultant SQL dump file, for compactness ...
|
I think you should be able to do that with this..
PHP Code:
// now execute the backup
exec('mysqldump --add-drop-table -h' .DB_HOST. ' -u' .DB_USER. ' -p' .DB_PASSWORD. ' ' .DB_NAME. ' 2>' .DUMP_PATH. '/' .DUMP_DATE. '-error.txt >' .DUMP_PATH. '/' .DUMP_DATE. '.sql');
// now archive and compress the backup
exec('tar -cSz --remove-files -C' .DUMP_PATH. ' -f' .DUMP_PATH. '/' .DUMP_DATE. '.tar.gz ' .DUMP_DATE. '.sql ' .DUMP_DATE. '-error.txt');