koppcha
asked on
perl system command never returns
Hi,
I have web page in which i need to run per script(#1) on a given host. I am using Net::SSH::Perl to run the script on the host.
perl script #1 calls perl script #2(which is a Daemon process running the background. This program will come back immediately when i run it from the command prompt) using system function. This system function never returns it call the Daemon process and it never returns. Any idea what could be the reason.
I have web page in which i need to run per script(#1) on a given host. I am using Net::SSH::Perl to run the script on the host.
perl script #1 calls perl script #2(which is a Daemon process running the background. This program will come back immediately when i run it from the command prompt) using system function. This system function never returns it call the Daemon process and it never returns. Any idea what could be the reason.
Inside Web page
my $ssh = new Net::SSH::Perl($hostname);
$ssh->login( "user", "passwd" );
my $cmd = "/home/xxx/server_admin.pl START STAGE";
my ( $stdout, $stderr, $exit ) = $ssh->cmd($cmd);
print "Done Running" ###It never gets to this point
sever_admin.pl
eval {
my $directory = "/home/yyy/FP/bin";
chdir($directory);
my $cmd = "./server.pl FeedConfig_STAGE.txt start";
system($cmd); ##This command never returns
};
if($@) {
print {*STDERR} "Unable to start Feed Process Server: ". $@;
exit 1;
}
server.pl -->This is a Daemon process that runs in the background.
use strict;
use warnings;
use App::Daemon qw(daemonize);
$App::Daemon::logfile = $ENV{SERVER_LOG};
$App::Daemon::pidfile = $ENV{PID_FILE};
/*
all usefull stuff
*/
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER