mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
fix and enable systemd watchdog
There were following problems:
- configure.ac wrongly checked for defined HAVE_SYSTEMD; this
wasn't working, so the watchdog code was not compiled in.
Replace library search with explicit version check
- sd_notify() watchdog call was unsetting NOTIFY_SOCKET from env;
this means only first "watchdog ping" was delivered, each
subsequent one did not have socket to be sent to and systemd
was killing service
- after those fixes, enable Watchdog in systemd unit with one
minute intervals
This commit is contained in:
committed by
Nick Mathewson
parent
2aa2d0a1c5
commit
a8999acc3b
+3
-4
@@ -136,6 +136,9 @@ fi
|
||||
AC_SUBST(TOR_SYSTEMD_CFLAGS)
|
||||
AC_SUBST(TOR_SYSTEMD_LIBS)
|
||||
|
||||
PKG_CHECK_MODULES(SYSTEMD209, [systemd >= 209],
|
||||
[AC_DEFINE(HAVE_SYSTEMD_209,1,[Have systemd v209 or more])], [])
|
||||
|
||||
if test x$enable_systemd = xyes -a x$have_systemd != xyes ; then
|
||||
AC_MSG_ERROR([Explicitly requested systemd support, but systemd not found])
|
||||
fi
|
||||
@@ -155,10 +158,6 @@ cpu workers lock up here, so I will disable threads.])
|
||||
esac
|
||||
fi
|
||||
|
||||
ifdef([HAVE_SYSTEMD], [
|
||||
AC_SEARCH_LIBS([sd_watchdog_enabled], [systemd-daemon],
|
||||
[AC_DEFINE(HAVE_SYSTEMD_209,1,[Have systemd v209 or more])], [])
|
||||
])
|
||||
|
||||
case $host in
|
||||
*-*-solaris* )
|
||||
|
||||
Vendored
+1
@@ -11,6 +11,7 @@ ExecReload = /bin/kill -HUP ${MAINPID}
|
||||
KillSignal = SIGINT
|
||||
TimeoutSec = 30
|
||||
Restart = on-failure
|
||||
WatchdogSec = 1m
|
||||
LimitNOFILE = 32768
|
||||
|
||||
# Hardening
|
||||
|
||||
+1
-1
@@ -1776,7 +1776,7 @@ static periodic_timer_t *systemd_watchdog_timer = NULL;
|
||||
static void
|
||||
systemd_watchdog_callback(periodic_timer_t *timer, void *arg)
|
||||
{
|
||||
sd_notify(1, "WATCHDOG=1");
|
||||
sd_notify(0, "WATCHDOG=1");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user