stale PID file detection -- previous patch cleanup and supress uninit warning
This commit is contained in:
parent
83d5f55b09
commit
dc14b06280
1 changed files with 1 additions and 2 deletions
|
|
@ -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";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue