my $hostgatewaybyte = "1";
our $watcher;
+# Pidfile to store the process-id of the running daemon.
+my $pidfile = "/run/guardian.pid";
# Path to guardianctrl.
my $guardianctrl = "/usr/local/bin/guardianctrl";
elsif ($pid) {
exit 0;
}
+
+ # Create pidfile.
+ open(PIDFILE, ">$pidfile") or die "Could not write pidfile. $!\n";
+
+ # Write process-id to the pidfile.
+ print PIDFILE "$$";
+
+ # Close pidfile.
+ close(PIDFILE);
}
#
&logger("debug", "Removing $address for shutdown\n");
&call_unblock ($address);
}
+ # Delete pidfile.
+ unlink $pidfile;
+
exit;
}