I am very much new with Phpseclib, and I am trying to sh/execute shell script available on my remote server using Phpseclib
set_include_path(get_include_path() . PATH_SEPARATOR . 'lib/phpseclib1.0.5');
include('lib/phpseclib1.0.5/Net/SSH2.php');
define('NET_SSH2_LOGGING', NET_SSH2_LOG_COMPLEX);
include_once ("admin/model/JobDAO.php");
$ssh = new Net_SSH2('192.168.11.68');
if (!$ssh->login('amit', 'password')) {
exit('Login Failed');
}
$ssh->setTimeout(1000);
$deployment_script="./InstallJava-Final.sh";
$ssh->exec(
$deployment_script, function ($str) {
echo $str;
flush();
ob_flush();
});
?>
Above PHP code trigger my shell script InstallJava-Final.sh which is available in the remote server and show the output on the browser that It's downloading java from oracle website using wget but few second later the process Stopped.
My remote script should run properly without interruption/stop with root user

No comments:
Post a Comment