if you are under redhat you should use "daemon()" from an init script (it's a shell function)#!/usr/bin/perl -w use File::Basename; my ($daemon, @args) = @ARGV; my $pid; if($pid =fork()) { # i am parent.. my $dname = basename($daemon); # maybe here you prefer # my $dname = basename($args[1]) . '.pid'; open PIDFILE, ">/var/run/$dname" || die "cannot write pid file"; print PIDFILE $pid; close PIDFILE; } else { exec($daemon, @args) || die "cannot execute $daemon: $!"; }
In reply to Re: working with pid's
by cianoz
in thread working with pid's
by djw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |