in reply to working with pid's

you could execute your server process with something like that:
#!/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: $!"; }
if you are under redhat you should use "daemon()" from an init script (it's a shell function)
why reinvent the weel?