diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-08-07 14:15:22 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-08-07 14:15:22 +0100 |
commit | f7e05d2cca6f179a2f3f44175de2b7810458ae25 (patch) | |
tree | 3bed9fbc03020a47a10ac0b670d1797fc8c8b2fa /centos/sources | |
parent | 66ffcdfa880daeb3b50c7ef3bcb5511abb6d92f6 (diff) | |
download | rspamd-f7e05d2cca6f179a2f3f44175de2b7810458ae25.tar.gz rspamd-f7e05d2cca6f179a2f3f44175de2b7810458ae25.zip |
[Fix] Fix endless loop when waiting for Rspamd to stop
Diffstat (limited to 'centos/sources')
-rw-r--r-- | centos/sources/rspamd.init | 19 |
1 files changed, 15 insertions, 4 deletions
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 |