diff --git a/Changelog.rst b/Changelog.rst index 5ddcccf..7d8992a 100644 --- a/Changelog.rst +++ b/Changelog.rst @@ -7,6 +7,9 @@ ChangeLog WIP (add new stuff for the next release) ======================================== +======= +* SIGHUP is now handled as the termination notification rather than + the signal to reread the configuration (Dmitrijs Ledkovs) * Honor the timezone of emails (Tobias Thierer) OfflineIMAP v6.5.5-rc1 (2012-09-05) diff --git a/docs/MANUAL.rst b/docs/MANUAL.rst index 96d5d91..0e080a1 100644 --- a/docs/MANUAL.rst +++ b/docs/MANUAL.rst @@ -308,7 +308,8 @@ SAFE CONNECTION GUARANTEEING THE AUTHENTICITY OF YOUR IMAP SERVER! UNIX Signals ============ -OfflineImap listens to the unix signals SIGUSR1 and SIGUSR2. +OfflineImap listens to the unix signals SIGUSR1, SIGUSR2, SIGTERM, +SIGINT, SIGHUP: If sent a SIGUSR1 it will abort any current (or next future) sleep of all accounts that are configured to "autorefresh". In effect, this will trigger a @@ -319,6 +320,12 @@ accounts will abort any current sleep and will exit after a currently running synchronization has finished. This signal can be used to gracefully exit out of a running offlineimap "daemon". +SIGTERM, SIGINT, SIGHUP are all treated to gracefully terminate as +soon as possible. This means it will finish syncing the current folder +in each account, close keep alive connections, remove locks on the +accounts and exit. It may take up to 10 seconds, if autorefresh option +is used. + Folder filtering and nametrans ============================== diff --git a/offlineimap/init.py b/offlineimap/init.py index 24d6c1a..94a9a18 100644 --- a/offlineimap/init.py +++ b/offlineimap/init.py @@ -329,14 +329,14 @@ class OfflineImap: syncaccounts.append(account) def sig_handler(sig, frame): - if sig == signal.SIGUSR1 or sig == signal.SIGHUP: + if sig == signal.SIGUSR1: # tell each account to stop sleeping accounts.Account.set_abort_event(self.config, 1) elif sig == signal.SIGUSR2: # tell each account to stop looping getglobalui().warn("Terminating after this sync...") accounts.Account.set_abort_event(self.config, 2) - elif sig == signal.SIGTERM or sig == signal.SIGINT: + elif sig in (signal.SIGTERM, signal.SIGINT, signal.SIGHUP): # tell each account to ABORT ASAP (ctrl-c) getglobalui().warn("Terminating NOW (this may "\ "take a few seconds)...")