in reply to Re^2: Have perl to start another perl script
in thread Have perl to start another perl script
system always returns 0 on successful launch. I recommend you do all the pid-saving in a wrapper shellscript (or Perlscript) around your child program:
#!/usr/bin/perl -w use strict; my $pid = $$; my ($IPaddress) = @ARGV; # Save our PID into the pidfile: my $pidfile = "/home/ember/devices/$Macaddress/$pid.pid"; open (FILE, "> $pidfile") or die "Can't create file $pidfile: $!\n"; print FILE "$pidfile\n"; close FILE; # and replace ourselves with the real program, which gets the same PID + as we had: exec 'other.pl', $IPaddress;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Have perl to start another perl script
by hakana (Acolyte) on Jul 31, 2007 at 09:30 UTC |