From: Vsevolod Stakhov Date: Tue, 7 Aug 2018 13:15:22 +0000 (+0100) Subject: [Fix] Fix endless loop when waiting for Rspamd to stop X-Git-Tag: 1.8.0~302 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f7e05d2cca6f179a2f3f44175de2b7810458ae25;p=rspamd.git [Fix] Fix endless loop when waiting for Rspamd to stop --- diff --git a/centos/sources/rspamd.init b/centos/sources/rspamd.init index 67bfa15ff..3dd3b99be 100644 --- a/centos/sources/rspamd.init +++ b/centos/sources/rspamd.init @@ -11,7 +11,7 @@ # Description: Rspamd spam filtering daemon process ### END INIT INFO # -# chkconfig: - 85 15 +# chkconfig: - 85 15 # description: rspamd is a spam filtering system # processname: rspamd # config: /etc/rspamd/rspamd.conf @@ -58,11 +58,22 @@ stop() { if [ "$CONSOLETYPE" != "serial" ]; then echo -en "\\033[16G" fi - while rh_status_q - do + STOPTIMEOUT=30 + while [ $STOPTIMEOUT -gt 0 ]; do + rh_status_q || break sleep 1 - echo -n $"." + let STOPTIMEOUT=${STOPTIMEOUT}-1 done + if [ $STOPTIMEOUT -eq 0 ]; then + echo "Timeout error occurred trying to stop Rspamd. Forcefully stop the remaining processes." + killproc $prog -KILL + # Sleep forever after SIGKILL being sent (e.g. UNINT SLEEP) + while rh_status_q + do + sleep 1 + echo -n $"." + done + fi rm -f $lockfile fi echo