I need to launch a Perl script on server B from server A with a PHP WebPage through SSH.
My command looks like:
$cmd_string="ssh user@serverB 'perl path/to/script.pl param1 param2'";
I tried both inside PHP script but nothing happen:
exec(sprintf("%s > %s 2>&1 & echo $! >> %s", $cmd_string, $outputfile, $pidfile));
exec($cmd_string, $output);
Running this command through terminal works just well.
Thanks for your help
Could not create directory '/var/www/.ssh'. Host key verification failed.It looks as if process is ran by 'www-data' instead of 'user'??&&just before theecho? One&would throw the command into the background and run theechoindependently: I guess it would report if it could launch the first program, but not the first program's status.