Merge pull request #7588 from Security-Onion-Solutions/fix/prevent-multiple-instances

FIX: Prevent multiple instances of so-sensor-clean and so-playbook-sync #6622
This commit is contained in:
Doug Burks
2022-03-16 13:54:00 -04:00
committed by GitHub
2 changed files with 4 additions and 4 deletions

View File

@@ -18,7 +18,7 @@
. /usr/sbin/so-common . /usr/sbin/so-common
# Check to see if we are already running # Check to see if we are already running
IS_RUNNING=$(ps aux | pgrep -f "so-playbook-sync" | wc -l) NUM_RUNNING=$(pgrep -cf "so-playbook-sync")
[ "$IS_RUNNING" -gt 3 ] && echo "$(date) - Multiple Playbook Sync processes already running...exiting." && exit 0 [ "$NUM_RUNNING" -gt 1 ] && echo "$(date) - $NUM_RUNNING Playbook sync processes running...exiting." && exit 0
docker exec so-soctopus python3 playbook_play-sync.py docker exec so-soctopus python3 playbook_play-sync.py

View File

@@ -115,8 +115,8 @@ clean() {
} }
# Check to see if we are already running # Check to see if we are already running
IS_RUNNING=$(ps aux | pgrep -f "so-sensor-clean" | wc -l) NUM_RUNNING=$(pgrep -cf "so-sensor-clean")
[ "$IS_RUNNING" -gt 3 ] && echo "$(date) - $IS_RUNNING sensor clean script processes running...exiting." >>$LOG && exit 0 [ "$NUM_RUNNING" -gt 1 ] && echo "$(date) - $NUM_RUNNING sensor clean script processes running...exiting." >>$LOG && exit 0
if [ "$CUR_USAGE" -gt "$CRIT_DISK_USAGE" ]; then if [ "$CUR_USAGE" -gt "$CRIT_DISK_USAGE" ]; then
while [ "$CUR_USAGE" -gt "$CRIT_DISK_USAGE" ]; do while [ "$CUR_USAGE" -gt "$CRIT_DISK_USAGE" ]; do