stale PID file detection -- previous patch cleanup and supress uninit warning

This commit is contained in:
Scott Walters 2010-05-28 08:38:38 -04:00
parent 83d5f55b09
commit dc14b06280

View file

@ -114,10 +114,9 @@ elsif ($daemon) {
die "Spectre is already running.\n";
}
elsif (-e $pidFileName){
# oh, ffs ... die "pidFile $pidFileName already exists\n";
open my $pidFile, '<', $pidFileName or die "$pidFileName: $!";
(my $pid) = readline $pidFile;
chomp $pid;
chomp $pid if defined $pid;
if(defined $pid and $pid =~ m/^(\d+)$/) {
if(kill 0, $1) {
die "$0: already running as PID $1";