I am trying to execute remote script using following command by connecting to one of the server using Net::SSH::Expect perl module.
$ssh->exec("python test.py");
Script is shown below:
#!/usr/bin/perl
use Net::SSH::Expect;
my $ssh = Net::SSH::Expect->new (
host => 'hostip', #deb-2-scripting ip
user => 'user',
password => 'password',
raw_pty => 1
);
..
..
$result = $ssh->exec("python test.py");
..
..
$ssh->close();
Actually this remote script (test.py) is taking longer than expected to execute (Because its having so many checks inside).
- Is there any way that I can just fire this script
(test.py)and continue with my perl script execution (I dont want to wait till test.py execution completion). OR - How can I wait till the test.py execution completion without giving timeout.
Since I could see by giving
$ssh->exec("python test.py", 10);this waits for 10 seconds so thattest.pyexecution gets succeeded.
$ssh->exec("python test.py &");? See Run a Unix process in the background