diff options
author | Lukas Fleischer <lfleischer@calcurse.org> | 2016-01-26 19:14:08 +0100 |
---|---|---|
committer | Lukas Fleischer <lfleischer@calcurse.org> | 2016-01-26 19:14:08 +0100 |
commit | f0ec3247bc1b9cd857d3bb00cf8f85d965342f23 (patch) | |
tree | cdf9e2b5c90be80c3804a777fc7494f4816a728a /src | |
parent | 3dbfc7c1f5d9451dbf8fc37fc621c7cc80010214 (diff) | |
download | calcurse-f0ec3247bc1b9cd857d3bb00cf8f85d965342f23.zip |
Support SIGUSR1 in daemon mode
In commit 7f62fb1 (Let SIGUSR1 trigger a reload, 2014-10-10), we added
support for reloading the data files by sending SIGUSR1 to an
interactive calcurse process. Add the same functionality to the daemon
mode.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/dmon.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -66,6 +66,11 @@ static unsigned data_loaded; static void dmon_sigs_hdlr(int sig) { + if (sig == SIGUSR1) { + want_reload = 1; + return; + } + if (data_loaded) free_user_data(); @@ -138,6 +143,7 @@ static unsigned daemonize(int status) || !sigs_set_hdlr(SIGTERM, dmon_sigs_hdlr) || !sigs_set_hdlr(SIGALRM, dmon_sigs_hdlr) || !sigs_set_hdlr(SIGQUIT, dmon_sigs_hdlr) + || !sigs_set_hdlr(SIGUSR1, dmon_sigs_hdlr) || !sigs_set_hdlr(SIGCHLD, SIG_IGN)) return 0; @@ -172,6 +178,12 @@ void dmon_start(int parent_exit_status) for (;;) { int left; + if (want_reload) { + want_reload = 0; + io_reload_data(); + notify_check_next_app(1); + } + if (!notify_get_next_bkgd()) DMON_ABRT(_("error loading next appointment\n")); |