mirror of https://github.com/zulip/zulip.git
puppet: Use pgrep -x to avoid accidental matches.
Matching the full process name (-x without -f) or full command line (-xf) is less prone to mistakes like matching a random substring of some other command line or pgrep matching itself. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
9e243c74ed
commit
9d57fa9759
|
@ -4,7 +4,7 @@ datafile=$(mktemp)
|
|||
|
||||
# We expect other Nagios checks to monitor for whether no queue
|
||||
# workers are running, so we give that condition a pass
|
||||
processes=$(pgrep -f '^python.* /home/zulip/deployments/current/manage.py process_queue')
|
||||
processes=$(pgrep -xf 'python.* /home/zulip/deployments/current/manage.py process_queue .*')
|
||||
if [ -z "$processes" ]; then
|
||||
echo "No workers running"
|
||||
exit 0
|
||||
|
|
|
@ -59,7 +59,7 @@ class zulip::profile::rabbitmq {
|
|||
# running and exits if so.
|
||||
exec { 'epmd':
|
||||
command => 'epmd -daemon',
|
||||
unless => 'which pgrep && pgrep -f [e]pmd >/dev/null',
|
||||
unless => 'which pgrep && pgrep -x epmd >/dev/null',
|
||||
require => Package[$erlang],
|
||||
path => '/usr/bin/:/bin/',
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ class zulip::supervisor {
|
|||
# don't match.
|
||||
hasrestart => true,
|
||||
# lint:ignore:140chars
|
||||
restart => "bash -c 'if pgrep -f supervisor[d] >/dev/null; then supervisorctl reread && supervisorctl update; else ${zulip::common::supervisor_start}; fi'",
|
||||
restart => "bash -c 'if pgrep -x supervisord >/dev/null; then supervisorctl reread && supervisorctl update; else ${zulip::common::supervisor_start}; fi'",
|
||||
# lint:endignore
|
||||
}
|
||||
exec { 'supervisor-restart':
|
||||
|
|
|
@ -1 +1 @@
|
|||
* * * * * root /bin/bash -c '(pgrep -u nobody -f camo || /etc/init.d/camo restart) 2>&1 >>/var/log/camo/restart-log'
|
||||
* * * * * root /bin/bash -c '(pgrep -u nobody -F /var/run/camo.pid || /etc/init.d/camo restart) 2>&1 >>/var/log/camo/restart-log'
|
||||
|
|
|
@ -138,7 +138,7 @@ if action == "start" or args.less_graceful:
|
|||
using_sso = subprocess.check_output(["./scripts/get-django-setting", "USING_APACHE_SSO"])
|
||||
if using_sso.strip() == b"True":
|
||||
logging.info("Restarting Apache WSGI process...")
|
||||
subprocess.check_call(["pkill", "-f", "apache2", "-u", "zulip"])
|
||||
subprocess.check_call(["pkill", "-x", "apache2", "-u", "zulip"])
|
||||
|
||||
logging.info("Done!")
|
||||
print(OKGREEN + f"Zulip {action}ed successfully!" + ENDC)
|
||||
|
|
Loading…
Reference in New Issue