Handle missing xinetd PID file
authorJamie Cameron <jcameron@webmin.com>
Mon, 23 Mar 2009 18:12:17 +0000 (18:12 +0000)
committerJamie Cameron <jcameron@webmin.com>
Mon, 23 Mar 2009 18:12:17 +0000 (18:12 +0000)
status/xinetd-monitor.pl

index 2b43a99..9f033c1 100644 (file)
@@ -5,11 +5,12 @@ sub get_xinetd_status
 {
 local %xconfig = &foreign_config($_[1]);
 return { 'up' => -1 } if (!-r $xconfig{'xinetd_conf'});
-if (open(PID, $xconfig{'pid_file'}) && <PID> =~ /(\d+)/ && kill(0, $1)) {
-       close(PID);
+&foreign_require($_[1], "xinetd-lib.pl");
+if (&xinetd::is_xinetd_running()) {
        local @st = stat($xconfig{'pid_file'});
        return { 'up' => 1,
-                'desc' => &text('up_since', scalar(localtime($st[9]))) };
+                'desc' => @st ? &text('up_since', scalar(localtime($st[9])))
+                              : undef };
        }
 return { 'up' => 0 };
 }