sub daemonize { # usage: daemonize( [errorlog path, activitylog path] ) my $errlog=shift; my $actlog=shift; $errlog ||="/dev/null"; $actlog ||="/dev/null"; chdir '/' or die "can't chdir to root : $!"; open( STDIN, '</dev/null' ) or die "can't redirect STDIN : $!"; open( STDERR, ">>$errlog" ) or die "can't redirect STDERR : $!"; open( STDOUT, ">>$actlog" ) or die "can't redirect STDOUT : $!"); fork and exit; return 1; }
In reply to Re: Fork issues
by wazoox
in thread Fork issues
by 3SRT
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |