add documentation about SIGABRT

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht 2017-01-27 19:41:47 +01:00
parent 0991af6855
commit c58b035cd1
4 changed files with 41 additions and 7 deletions

View File

@ -12,8 +12,38 @@ updated: 2015-03-25
## Systemd units ## Systemd units
These unit files are meant to be used in the user session. You may drop them into `/etc/systemd/user` or `${XDG_DATA_HOME}/systemd/user` followed by `systemctl --user daemon-reload` to have systemd aware of the unit files. These unit files are meant to be used in the user session. You may drop them
into `/etc/systemd/user` or `${XDG_DATA_HOME}/systemd/user` followed by
`systemctl --user daemon-reload` to have systemd aware of the unit files.
These files are meant to be triggered either manually using `systemctl --user start offlineimap.service` or by enabling the timer unit using `systemctl --user enable offlineimap.timer`. Additionally, specific accounts may be triggered by using `offlineimap@myaccount.timer` or `offlineimap@myaccount.service`. These files are meant to be triggered either manually using `systemctl --user
start offlineimap.service` or by enabling the timer unit using `systemctl --user
enable offlineimap.timer`. Additionally, specific accounts may be triggered by
using `offlineimap@myaccount.timer` or `offlineimap@myaccount.service`.
These unit files are installed as being enabled via a `mail.target` unit which
is intended to be a catch-all for mail-related unit files. A simple
`mail.target` file is also provided.
## Signals
Systemd supports a watchdog (via the WatchdogSec service file option) which
will send the program a SIGABRT when the timer expires.
Offlineimap handles it in the same manner as SIGUSR2, so that the current
synchronisation is completed before the program exits safely.
This makes offlineimap more flexible and robust for persistent setups that make
use of holdconnectionopen and autorefresh options.
For example, it may be useful in assisting with the occasional situation where
offlineimap may not return successfully after a suspend and resume.
To make use of this, users could add the following to the [Service] section of
their systemd offlineimap service file (restart every 5 minutes):
``` conf
Restart=on-watchdog
WatchdogSec=300
```
These unit files are installed as being enabled via a `mail.target` unit which is intended to be a catch-all for mail-related unit files. A simple `mail.target` file is also provided.

View File

@ -6,6 +6,8 @@ Type=oneshot
ExecStart=/usr/bin/offlineimap -o -u syslog ExecStart=/usr/bin/offlineimap -o -u syslog
# Give 12 seconds for offlineimap to gracefully stop before hard killing it. # Give 12 seconds for offlineimap to gracefully stop before hard killing it.
TimeoutStopSec=12 TimeoutStopSec=12
#Restart=on-watchdog
#WatchdogSec=300
[Install] [Install]
WantedBy=mail.target WantedBy=mail.target

View File

@ -4,6 +4,8 @@ Description=Offlineimap Service for account %i
[Service] [Service]
Type=oneshot Type=oneshot
ExecStart=/usr/bin/offlineimap -o -a %i -u syslog ExecStart=/usr/bin/offlineimap -o -a %i -u syslog
#Restart=on-watchdog
#WatchdogSec=300
[Install] [Install]
WantedBy=mail.target WantedBy=mail.target

View File

@ -315,10 +315,10 @@ SIGHUP, SIGQUIT.
accounts that are configured to 'autorefresh'. In effect, this will trigger a accounts that are configured to 'autorefresh'. In effect, this will trigger a
full sync of all accounts to be performed as soon as possible. full sync of all accounts to be performed as soon as possible.
* If sent a SIGUSR2, it will stop 'autorefresh' mode for all accounts. That * If sent a SIGUSR2 or SIGABRT, it will stop 'autorefresh' mode for all
is, accounts will abort any current sleep and will exit after a currently accounts. That is, accounts will abort any current sleep and will exit after a
running synchronization has finished. This signal can be used to gracefully currently running synchronization has finished. This signal can be used to
exit out of a running offlineimap "daemon". gracefully exit out of a running offlineimap "daemon".
* SIGTERM, SIGINT, SIGHUP are all treated to gracefully terminate as soon as * SIGTERM, SIGINT, SIGHUP are all treated to gracefully terminate as soon as
possible. This means it will finish syncing the current folder in each possible. This means it will finish syncing the current folder in each