in reply to Re: Is it possible to background a perl script from within itself?
in thread Is it possible to background a perl script from within itself?
#!/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...
|
|---|