Re: [Ssh-sftp-perl-users] How to execute ssh command in background ?
Brought to you by:
dbrobins
From: Mark F. <mar...@ea...> - 2004-03-11 15:02:30
|
I use Perl's "fork" function. Put the following in a subroutine and call this subroutine from your "foreach" loop. If you need to avoid zombies, you'll have to use "$SIG{CHLD}= 'IGNORE'" (or refer to a subroutine which will "waitpid" to harvest the children.) ============================ my $childPid = fork; # fork a new copy of script if ($childPid) { return; # parent returns } if (!defined($childPid)) { print STDERR 'Fork failed.' . "\n"; exit 99; } # do your ssh command here exit; # child exits, do *not* return ============================= Mark ----- Original Message ----- From: "Jean-Paul Le Fèvre" <le...@he...> To: <ssh...@li...> Sent: Thursday, March 11, 2004 2:45 AM Subject: [Ssh-sftp-perl-users] How to execute ssh command in background ? > > > ssh(1) provides the option -f used to request > execution in background. I would like to have > this possibility with Net::SSH::Perl. > > I need a perl script to launch the same command > on several remote hosts, something like : > > foreach $host (@grid) > $ssh->cmd($my_command); > > However, doing so, the script stays blocked on > the first step and does not process the next > items in the list. > > I've tried to add '&' in various places but > unsuccessfully. > > P.S. > my_command is rmiregistry. > > > -- > ___________________________________________________________________ > > Jean-Paul Le Fèvre * Mail : Le...@fo... > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users |