explicitly sync journal when disabling watchdog updates
Without syncing the journal could loose logs for a small interval (ca
10-60 seconds), but these last seconds are really interesting for
analyzing the cause of a triggered watchdog.
Also without this often the
> "client did not stop watchdog - disable watchdog updates"
messages wasn't flushed to persistent storage and so some users had a
hard time to figure out why the machine reset.
Use the '--sync' switch of journalctl which - to quote its man page -
"guarantees that any log messages written before its invocation are
safely stored on disk at the time it returns."
Use execl to call `journalctl --sync` in a child process, do not care
for any error checks or recovery as we will be reset anyway. This is
just a hit or miss try to log the situation more consistently, if it
fails we cannot really do anything anyhow.
We call the function on two points:
a) if we exit with active connections, here the watchdog will be
triggered soon and we want to ensure that this is logged.
b) if a client closes the connection without sending the magic close
byte, here the watchdog would trigger while we hang in epoll at
the beginning of the loop, so sync the log here also.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>