]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/commitdiff
update-ids-ruleset: Early exit script if lockfile exists.
authorStefan Schantl <stefan.schantl@ipfire.org>
Sun, 27 Jun 2021 17:22:24 +0000 (19:22 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sun, 19 Dec 2021 12:23:45 +0000 (13:23 +0100)
This prevents from running the script while the WUI is performing
operations at the same time or to launch multiple instances of the
script.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
src/scripts/update-ids-ruleset

index 3a3f17443e4f5f2f46ad351a3529d3db792ae30c..10a2709074dfecc3575834d9a7970269b6501b65 100644 (file)
@@ -42,6 +42,17 @@ if ( $> == 0 ) {
        POSIX::setuid( $uid );
 }
 
+# Check if the IDS lock file exists.
+# In this case the WUI or another instance currently is altering the
+# ruleset.
+if (-f "$IDS::ids_page_lock_file") {
+       # Store notice to the syslog.
+       &IDS::_log_to_syslog("Another process currently is altering the IDS ruleset.");
+
+       # Exit.
+       exit 0;
+}
+
 # Check if the red device is active.
 unless (-e "${General::swroot}/red/active") {
        # Store notice in the syslog.