I'm running the innobackupex
script, but I don't know how to fetch the output from the script? I need the last line to check if the script succeeded or failed..
$output = shell_exec('innobackupex --user=root --password=xxx --databases="test" --stream=tar ./ | gzip -c -1 > /var/bak/2013-08-09-1431_mysql.tar.gz')
The script is working as it should and the backup zip is created, but $output
is empty
now the command is not being piped through to gzip, but still no output
$syntax = 'innobackupex --user='.$mysql_user.' --password='.$mysql_pass.' --databases="'.$mysql_db.'" /var/bak';
$output = shell_exec($syntax);
I don't mean to step on @RudyVisser's answers in comments, but here's another solution:
$syntax = 'innobackupex --user="'.$mysql_user.'" --password="'.$mysql_pass.'"
--databases="'.$mysql_db.'" --stream=tar ./ | gzip -c -1
> /var/bak/2013-08-09-1431_mysql.tar.gz ; echo $?')
$exit_status = shell_exec($syntax);
The echo inside the command should report the exit status of innobackupex, which is 0 if the backup was successful, and non-zero if there was an error.
http://www.percona.com/doc/percona-xtrabackup/2.1/xtrabackup_bin/xtrabackup_exit_codes.html
PS: Percona XtraBackup also has a --compress
option that uses the qpress algorithm, known to be very fast. I mention this because I notice you're using gzip -1
presumably for better performance.