From e849783a86c89066cc5e77a217a8bed842632f1a Mon Sep 17 00:00:00 2001 From: Jason Ertel Date: Wed, 7 Dec 2022 08:36:56 -0500 Subject: [PATCH] Reduce cron noise; ensure filecheck is restarted if modified --- salt/soc/init.sls | 2 +- salt/strelka/init.sls | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/salt/soc/init.sls b/salt/soc/init.sls index 64ebdc671..2a7346d88 100644 --- a/salt/soc/init.sls +++ b/salt/soc/init.sls @@ -88,7 +88,7 @@ socusersroles: salt-relay: cron.present: - - name: 'ps -ef | grep salt-relay | grep -v grep || /opt/so/saltstack/default/salt/soc/files/bin/salt-relay.sh >> /opt/so/log/soc/salt-relay.log 2>&1 &' + - name: 'pgrep -f "/opt/so/saltstack/default/salt/soc/files/bin/salt-relay.sh" &> /dev/null || /opt/so/saltstack/default/salt/soc/files/bin/salt-relay.sh >> /opt/so/log/soc/salt-relay.log 2>&1 &' so-soc: docker_container.running: diff --git a/salt/strelka/init.sls b/salt/strelka/init.sls index 3a62ab2be..860fe6f02 100644 --- a/salt/strelka/init.sls +++ b/salt/strelka/init.sls @@ -144,9 +144,17 @@ filecheck_script: - group: 939 - mode: 755 +filecheck_restart: + cmd.run: + - name: pkill -f "python3 /opt/so/conf/strelka/filecheck" + - hide_output: True + - success_retcodes: [0,1] + - onchanges: + - file: filecheck_script + filecheck_run: cron.present: - - name: 'ps -ef | grep filecheck | grep -v grep || python3 /opt/so/conf/strelka/filecheck >> /opt/so/log/strelka/filecheck_stdout.log 2>&1 &' + - name: 'pgrep -f "python3 /opt/so/conf/strelka/filecheck" &> /dev/null >> /opt/so/log/strelka/filecheck_stdout.log 2>&1 &' - user: {{ filecheck_runas }} filcheck_history_clean: