Passing a qsub command thru ssh2_exec in PHP

72 Views Asked by At

I have a problem with putting a "qsub" command via "ssh2_exec" in PHP.

when i am running a simple test it works very well:

require_once('/apps/phpPackages/vendor/autoload.php');
use phpseclib3\Net\SSH2;
$ssh=new SSH2('xxxxxxxxx');

if (!$ssh->login('xxxxx', 'xxxxxxx')) {
        exit('Login Failed<br>');
}else { echo "SSH Connection established<br>"; }

echo $ssh->exec('echo "Hello World" > test.sh');

but when i try to run a qsub command, the qstat shows the job is running but not stopping and the command is not executed at all.

require_once('/apps/phpPackages/vendor/autoload.php');
use phpseclib3\Net\SSH2;
$ssh=new SSH2('xxxxxxxxx');

if (!$ssh->login('xxxxx', 'xxxxxxx')) {
        exit('Login Failed<br>');
}else { echo "SSH Connection established<br>"; }

echo $ssh->exec('qsub list_of_command.sh');

if I run directly on the terminal qsub list_of_command.sh

the job is executed and I have the results needed

Any idea why qsub is not working properly through SSH2 ???

0

There are 0 best solutions below