There's more than one way to do things | |
PerlMonks |
Re: Answer: Is it possible to background a perl script from within itself?by hbo (Monk) |
on Apr 18, 2003 at 06:09 UTC ( [id://251396]=note: print w/replies, xml ) | Need Help?? |
You have to setsid too, to disassociate from your parent's process group:
#!/usr/bin/perl use strict; use warnings; use POSIX qw(setsid); # Become a daemon my $pid=fork; exit if $pid; # Parent exits here die "Couldn't fork $!" unless defined($pid); die "Couldn't start new session $!" unless POSIX::setsid(); # Do your daemon bit...
In Section
Seekers of Perl Wisdom
|
|