I created a script to copy a remote database using mysqldump inside a SSH connection. Then i ported to my PHP script so i can better manage several servers.
My problem is when the copy fails... I get no error code from the command.
This is the command:
ssh -p22 -i mykey.key -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null backup@hostname "mysqldump -hlocalhost -udbuser --databases db" > myfile.sql
It works =)
PHP code with simplified systax:
$comando = 'ssh -i mykey.key backup@hostname "mysqldump --databases db" > myfile.sql';
$ret_text = exec($comando, $output, $ret);
// Doesnt matter if command fails or sucess, result is?
//$ret = empty
//$output = empty
//$ret_text = empty
I need to know when the copy failed, does anyone know how to get a remote error code?
Thanks