diff --git a/scripts/restart-server b/scripts/restart-server index b1065d5981..0e3fa0313a 100755 --- a/scripts/restart-server +++ b/scripts/restart-server @@ -80,11 +80,16 @@ if has_application_server(): workers.extend(list_supervisor_processes("zulip-workers:*")) if has_application_server(once=True): + # These used to be included in "zulip-workers:*"; since we may + # be restarting an older version of Zulip, which has not + # applied puppet to reload the new list of processes, only + # stop them if they currently exist according to + # `supervisorctl`. workers.extend( - [ + list_supervisor_processes( "zulip_deliver_scheduled_emails", "zulip_deliver_scheduled_messages", - ] + ) ) if has_process_fts_updates(): diff --git a/scripts/stop-server b/scripts/stop-server index 5cf9f7f239..6de4def2dc 100755 --- a/scripts/stop-server +++ b/scripts/stop-server @@ -13,6 +13,7 @@ from scripts.lib.zulip_tools import ( WARNING, has_application_server, has_process_fts_updates, + list_supervisor_processes, ) deploy_path = os.path.realpath(os.path.join(os.path.dirname(__file__), "..")) @@ -41,11 +42,15 @@ if has_application_server(): services.extend(["zulip-tornado", "zulip-tornado:*"]) services.append("zulip-workers:*") if has_application_server(once=True): + # These used to be included in "zulip-workers:*"; since we may + # be stopping an older version of Zulip, which has not applied + # puppet to reload the new list of processes, only stop them + # if they currently exist according to `supervisorctl`. services.extend( - [ + list_supervisor_processes( "zulip_deliver_scheduled_emails", "zulip_deliver_scheduled_messages", - ] + ), ) subprocess.check_call(["supervisorctl", "stop", *services])