Clean up PID file on exit, if enabled

git-svn-id: https://svn.perl.org/qpsmtpd/trunk@492 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Devin Carraway 2005-07-10 11:38:40 +00:00
parent 1f7ece38f2
commit 58cce1ab30

View File

@ -23,7 +23,7 @@ my $PORT = 2525; # port number
my @LOCALADDR; # ip address(es) to bind to my @LOCALADDR; # ip address(es) to bind to
my $USER = 'smtpd'; # user to suid to my $USER = 'smtpd'; # user to suid to
my $MAXCONNIP = 5; # max simultaneous connections from one IP my $MAXCONNIP = 5; # max simultaneous connections from one IP
my $PID_FILE = ''; my $PID_FILE = ''; # file to which server PID will be written
sub usage { sub usage {
print <<"EOT"; print <<"EOT";
@ -78,6 +78,9 @@ sub REAPER {
sub HUNTSMAN { sub HUNTSMAN {
$SIG{CHLD} = 'DEFAULT'; $SIG{CHLD} = 'DEFAULT';
kill 'INT' => keys %childstatus; kill 'INT' => keys %childstatus;
if ($PID_FILE && -e $PID_FILE) {
unlink $PID_FILE or ::log(LOGERROR, "unlink: $PID_FILE: $!");
}
exit(0); exit(0);
} }