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>
This commit is contained in:
parent
3dbfc7c1f5
commit
f0ec3247bc
12
src/dmon.c
12
src/dmon.c
@ -66,6 +66,11 @@ static unsigned data_loaded;
|
|||||||
|
|
||||||
static void dmon_sigs_hdlr(int sig)
|
static void dmon_sigs_hdlr(int sig)
|
||||||
{
|
{
|
||||||
|
if (sig == SIGUSR1) {
|
||||||
|
want_reload = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (data_loaded)
|
if (data_loaded)
|
||||||
free_user_data();
|
free_user_data();
|
||||||
|
|
||||||
@ -138,6 +143,7 @@ static unsigned daemonize(int status)
|
|||||||
|| !sigs_set_hdlr(SIGTERM, dmon_sigs_hdlr)
|
|| !sigs_set_hdlr(SIGTERM, dmon_sigs_hdlr)
|
||||||
|| !sigs_set_hdlr(SIGALRM, dmon_sigs_hdlr)
|
|| !sigs_set_hdlr(SIGALRM, dmon_sigs_hdlr)
|
||||||
|| !sigs_set_hdlr(SIGQUIT, dmon_sigs_hdlr)
|
|| !sigs_set_hdlr(SIGQUIT, dmon_sigs_hdlr)
|
||||||
|
|| !sigs_set_hdlr(SIGUSR1, dmon_sigs_hdlr)
|
||||||
|| !sigs_set_hdlr(SIGCHLD, SIG_IGN))
|
|| !sigs_set_hdlr(SIGCHLD, SIG_IGN))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -172,6 +178,12 @@ void dmon_start(int parent_exit_status)
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
int left;
|
int left;
|
||||||
|
|
||||||
|
if (want_reload) {
|
||||||
|
want_reload = 0;
|
||||||
|
io_reload_data();
|
||||||
|
notify_check_next_app(1);
|
||||||
|
}
|
||||||
|
|
||||||
if (!notify_get_next_bkgd())
|
if (!notify_get_next_bkgd())
|
||||||
DMON_ABRT(_("error loading next appointment\n"));
|
DMON_ABRT(_("error loading next appointment\n"));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user