We help IT Professionals succeed at work.
Get Started

perl system command never returns

koppcha asked
Last Modified: 2012-05-09
  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

eval {
   my $directory = "/home/yyy/FP/bin";
   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

Open in new window

Watch Question
Most Valuable Expert 2014
Top Expert 2015
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE