]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/commitdiff
guardian: Prevent from running multiple instances.
authorStefan Schantl <stefan.schantl@ipfire.org>
Sat, 28 Feb 2015 08:55:25 +0000 (09:55 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sat, 28 Feb 2015 08:55:25 +0000 (09:55 +0100)
config/guardian/guardian

index 9374fe295dee17b3816e836a752dc14a530f6195..60fe04435e802772bcf9dc36a4da65cc3fac87aa 100644 (file)
@@ -114,6 +114,16 @@ if (defined($options{"h"})) {
        exit;
 }
 
+# Check if another guardian instance is running.
+if (-e "$pidfile") {
+       print STDERR "Guardian PID file found!\n\n";
+       print STDERR "Please  stop guardian or release the PID file\n";
+       print STDERR "if no other guardian instance is running.\n";
+
+       # Exit with return code "1".
+       exit 1;
+}
+
 # Call function to read in the configuration file.
 &load_conf;