1 (edited by cvcvelo 2025-02-18 05:03:50)

Topic: Faster restarts for SOGo on Debian

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.7.2
- Deployed with iRedMail Easy or the downloadable installer? Downloadable
- Linux/BSD distribution name and version: Debian 12.9
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL (MariaDB)
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? Yes
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Restarts of the SOGo process after nightly upgrades were taking about 20 seconds, with almost all of that coming from the stop command.

On Debian, this is because the systemd script in /etc/init.d/sogo uses the SIGTERM signal to try stopping the program, but systemd does not know how to do that with a SIGTERM signal. Instead the script waits for the 20-second timeout before just sending a SIGKILL symbol:

start-stop-daemon -c $USER --stop --pidfile $PIDFILE --retry=TERM/20/KILL/5 --oknodo
        rm -f $PIDFILE

As I learned with different program running on Debian, SIGTERM and SIGINT *should* be equivalent with systemd but they’re not. Only a SIGINT signal will stop the process.

On my system, I edited lines 80 and 87 of the /etc/init.d/sogo script to read like this:

start-stop-daemon -c $USER --stop --pidfile $PIDFILE --retry=INT/20/KILL/5 --oknodo
        rm -f $PIDFILE

After running ‘systemctl daemon-reload’, as with any change to startup/shutdown scripts, the system now stops (and restarts) SOGo almost instantaneously.

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Faster restarts for SOGo on Debian

Please report this issue to SOGo team, they maintain /etc/init.d/sogo:
https://www.sogo.nu/support.html

3

Re: Faster restarts for SOGo on Debian

Done, thanks.

I installed SOGo around 2020 as part of an iRedMail server build, and don’t remember the exact method I used for installation. The SOGo docs suggest just installing from packages:

https://www.sogo.nu/support/faq/how-to- … ebian.html

Fully agree this should run under systemd and use stop/restart signals systemd can understand. Thanks again.