diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-11-10 16:53:00 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-11-10 17:36:52 +0100 |
commit | b374689c02c681671a3c3c0b0fd3add32386b442 (patch) | |
tree | 7c2a354344733f1418e476005e1fc8969e181049 /src/journal | |
parent | a4c1800284e3546bbfab2dc19eb59bcb91c4a2ca (diff) |
journald: dispatch SIGTERM/SIGINT with a low priority
Let's make sure to process all queued log data before exiting, so that
we don't unnecessary lose messages when shutting down.
https://github.com/systemd/systemd/pull/1812#issuecomment-155149871
Diffstat (limited to 'src/journal')
-rw-r--r-- | src/journal/journald-server.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index f0d3a26372..36fe739073 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -1296,10 +1296,22 @@ static int setup_signals(Server *s) { if (r < 0) return r; + /* Let's process SIGTERM late, so that we flush all queued + * messages to disk before we exit */ + r = sd_event_source_set_priority(s->sigterm_event_source, SD_EVENT_PRIORITY_NORMAL+20); + if (r < 0) + return r; + + /* When journald is invoked on the terminal (when debugging), + * it's useful if C-c is handled equivalent to SIGTERM. */ r = sd_event_add_signal(s->event, &s->sigint_event_source, SIGINT, dispatch_sigterm, s); if (r < 0) return r; + r = sd_event_source_set_priority(s->sigint_event_source, SD_EVENT_PRIORITY_NORMAL+20); + if (r < 0) + return r; + return 0; } |