I have below Perl code where I am executing the java program on remote machine using NET:SSH:Expect.
I want java script to be run in background for my requirement but once I exit from the Perl code my java scripts running in background gets automatically killed.
Please suggest any solution.
#!/usr/bin/perl
#use strict refs;
#use warnings;
use Expect;
use Net::SSH::Expect;
my $ssh = Net::SSH::Expect-> new (
host => "MYHOST",
password => "user123",
user => "user123",
raw_pty => 1,
log_file => "log_file" # this line actually got my head spinn
+ing in right direction
);
my $login_output=$ssh->login();
sleep 1;
my $output=$ssh->exec("pwd");
warn "$output\n";
$ssh->exec("/sbin/fuser -k 9090/tcp");
my $output1=$ssh->exec("cd /home/tecnomen/JanusSIM2.0");
warn "$output1\n";
$ssh->exec("javac Atsi2.java");
sleep 1;
warn "starting the ATSI script\n";
my $output3=$ssh->exec("java Atsi2 &");
sleep 10;
warn"$output3\n";
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.