From c317f9575a28a9a1581e02dfef98bb55f10facba Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 3 Feb 2014 19:50:55 +0000 Subject: [PATCH] Only check pidfile if it exists. --- Webperl/Daemon.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Webperl/Daemon.pm b/Webperl/Daemon.pm index cf1eb6a..11d9ab1 100644 --- a/Webperl/Daemon.pm +++ b/Webperl/Daemon.pm @@ -163,8 +163,11 @@ sub detach { sub running { my $self = shift; - my $pid = eval { read_pid($self -> {"pidfile"}) }; - print $@ if($@); + my $pid; + if(-f $self -> {"pidfile"}) { + eval { $pid = read_pid($self -> {"pidfile"}) }; + print $@ if($@); + } return 0 if(!$pid); my $signalled = kill 0,$pid;