# 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;
In reply to Daemonize and open a file
by JamieD
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |