Prevent from running guardian twice.
authorStefan Schantl <stefan.schantl@ipfire.org>
Wed, 9 Dec 2015 13:49:11 +0000 (14:49 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Wed, 9 Dec 2015 13:49:11 +0000 (14:49 +0100)
Guardian now checks for an already running instance on startup and will
cancel if there has been found one.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
guardian

index 58a0819..2a5b460 100644 (file)
--- a/guardian
+++ b/guardian
@@ -66,6 +66,11 @@ if (defined($cmdargs{"help"})) {
        exit;
 }
 
+# Check if another instance of guardian is allready running.
+if (&Guardian::Daemon::IsRunning()) {
+       die "Another instance of Guardian is allready running...\n";
+}
+
 # Read-in the configuration file and store the settings.
 # Push the may be given config file argument.
 my %mainsettings = &Guardian::Config::UseConfig($cmdargs{"config"});