JamieD has asked for the wisdom of the Perl Monks concerning the following question:
# deamonize the server
Proc::Daemon::Init;
#open FDserv.p and write in the process id number
my $pid = POSIX::getpid();
open FILE, "FDserv.p" or die "Couldn't open: $!";
my @fileArray = <FILE>;
close FILE;
open FILE, ">FDserv.p" or die "Couldn't open: $!";
foreach(@fileArray){
if(/id=(.*)/){
print FILE "id=".$pid.";";
}else{
print FILE $_;
}
}
close FILE;
- Comment on Daemonize and open a file
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Daemonize and open a file
by rob_au (Abbot) on Dec 06, 2002 at 05:48 UTC | |
by JamieD (Novice) on Dec 06, 2002 at 09:40 UTC | |
by OfficeLinebacker (Chaplain) on Jul 19, 2006 at 14:04 UTC |