gerry has asked for the wisdom of the Perl Monks concerning the following question:
Thanks for all your help.$version = "test"; $pid = get_pid($version); if ( $pid eq "" ) # if null, MEVS not running - issue comma +nd to start MEVS { @command = ("/mevs/$version/bin/mevs", "/mevs/$version/data/con +fig_data/mevs2.cfg", "online", "&"); system(@command); # restart MEVS $pid = get_pid($version); # Get the new pid print "new pid: [$pid]\n"; # print pid . . . ###################################################################### +###### sub get_pid ###################################################################### +###### { my $version = $_[0]; # passed version, prod/test/qa my $command = sprintf q(ps -ef | grep %s | grep online | awk '{pri +nt $2}'), $version; # create get pid command my @output = `$command`; # get the pid(s) return $output[0]; # return new pid + }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Creating External Processes without losing control
by samtregar (Abbot) on Dec 01, 2004 at 21:29 UTC | |
by Anonymous Monk on Dec 02, 2004 at 14:50 UTC | |
by samtregar (Abbot) on Dec 02, 2004 at 16:50 UTC | |
|
Re: Creating External Processes without losing control
by edan (Curate) on Dec 02, 2004 at 13:41 UTC | |
|
Re: Creating External Processes without losing control
by zentara (Cardinal) on Dec 02, 2004 at 14:05 UTC | |
|
Re: Creating External Processes without losing control
by bprew (Monk) on Dec 01, 2004 at 22:54 UTC | |
by Anonymous Monk on Dec 02, 2004 at 01:19 UTC |