As you can see, i try to start "top" - which errs with "TERM environment variable not set." - but even if i were able to start a service using the $remoteCmd = `ssh... cmd, whatever service i start, i need to capture the pid # of the service i just started. i tried your code like this, which did produce a temporary pid:#!/usr/bin/perl -w use Net::SSH::Perl; use Net::SSH::Expect; my $remoteCmd = `ssh myserverid.company.com -l myuid -i /home/myuid/.s +sh/authorized_keys top`;
... and that pid prints; so whatever that did, it produced a pid; but i want is to start my own service or process, then capture that pid. then i will check the process table to see if the pid name, and pid # exist. if so, the process is running. if not, i need to restart it. i hope i am clear. basically, i need to ssh to a remote server, start a process, then capture the pid # back to the local perl script that calls the ssh. any ideas? can you help? again, if i am not clear, i will retool my presentation again and strive for even more clarity. thanks!#!/usr/bin/perl -w use IO::Handle; my $handle = IO::Handle->new; my $pid = open($handle, 'command & |') or die $!; print $pid;
In reply to Re: Launch process, get PID
by dcparham
in thread Launch process, get PID
by rvosa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |