Permalink
Browse files

support systemd sd_notify

  • Loading branch information...
cjmayo authored and pjstevns committed Jul 22, 2016
1 parent 17c7e5f commit c6773f6b5ff6d87513c3759565df1700128c7e42
View
@@ -22,6 +22,7 @@ AC_MSG_RESULT([
MHASH: $MHASHLIB
LIBEVENT: $EVENTLIB
OPENSSL: $SSLLIB
SYSTEMD: $SYSTEMD_LIBS
ZDB: $ZDBLIB
JEMALLOC: $JEMALLOCLIB
@@ -347,6 +348,16 @@ AC_DEFUN([DM_CHECK_SSL], [
fi
])
AC_DEFUN([DM_CHECK_SYSTEMD], [
PKG_CHECK_MODULES([SYSTEMD], [libsystemd-daemon], , [
PKG_CHECK_MODULES([SYSTEMD], [systemd >= 230])
])
if test [ -n $SYSTEMD_LIBS ]; then
AC_DEFINE([HAVE_SYSTEMD], [1], [Define if systemd will be used])
LDFLAGS="$LDFLAGS $SYSTEMD_LIBS"
fi
])
AC_DEFUN([AC_COMPILE_WARNINGS],
[AC_MSG_CHECKING(maximum warning verbosity option)
if test -n "$CXX"; then
View
@@ -47,6 +47,9 @@ AM_CONDITIONAL(MANPAGES, [ test "$enable_manpages" = "yes" ])
AC_ARG_ENABLE([systemd],
AS_HELP_STRING([--enable-systemd], [Enable systemd support]))
AM_CONDITIONAL(SYSTEMD, [ test "$enable_systemd" = "yes" ])
if [ test "$enable_systemd" = "yes" ]; then
DM_CHECK_SYSTEMD
fi
AC_PROG_CC
AC_COMPILE_WARNINGS
View
@@ -149,6 +149,10 @@
#include <sieve2_error.h>
#endif
#ifdef HAVE_SYSTEMD
#include <systemd/sd-daemon.h>
#endif
#ifdef HAVE_CRYPT_H
#include <crypt.h>
#endif
View
@@ -322,6 +322,9 @@ int StartCliServer(ServerConfig_T * conf)
{
assert(conf);
server_start_cli(conf);
#ifdef HAVE_SYSTEMD
sd_notify(0, "STOPPING=1");
#endif
return 0;
}
@@ -846,7 +849,9 @@ int server_run(ServerConfig_T *conf)
if (MATCH(conf->service_name, "IMAP"))
dm_queue_heartbeat();
#ifdef HAVE_SYSTEMD
sd_notify(0, "READY=1");
#endif
TRACE(TRACE_DEBUG,"dispatching event loop...");
event_base_dispatch(evbase);
View
@@ -50,7 +50,6 @@ SUFFIXES=.service.in .service .tmpfiles.in .tmpfiles
.service.in.service:
$(AM_V_GEN)sed \
-e 's|[@]sbindir[@]|$(sbindir)|g' \
-e 's|[@]piddir[@]|$(PID_DIR)|g' \
< $< > $@-t && \
mv $@-t $@
@@ -3,9 +3,8 @@ Description=DBMail Imap Server
After=syslog.target network.target mysqld.service postgresql.service
[Service]
Type=forking
PIDFile=@piddir@/dbmail-imapd.pid
ExecStart=@sbindir@/dbmail-imapd -p @piddir@/dbmail-imapd.pid
Type=notify
ExecStart=@sbindir@/dbmail-imapd -D
[Install]
WantedBy=multi-user.target
@@ -3,9 +3,8 @@ Description=DBMail LMTP Server
After=syslog.target network.target mysqld.service postgresql.service
[Service]
Type=forking
PIDFile=@piddir@/dbmail-lmtpd.pid
ExecStart=@sbindir@/dbmail-lmtpd -p @piddir@/dbmail-lmtpd.pid
Type=notify
ExecStart=@sbindir@/dbmail-lmtpd -D
[Install]
WantedBy=multi-user.target
@@ -3,9 +3,8 @@ Description=DBMail pop3 Server
After=syslog.target network.target mysqld.service postgresql.service
[Service]
Type=forking
PIDFile=@piddir@/dbmail-pop3d.pid
ExecStart=@sbindir@/dbmail-pop3d -p @piddir@/dbmail-pop3d.pid
Type=notify
ExecStart=@sbindir@/dbmail-pop3d -D
[Install]
WantedBy=multi-user.target
@@ -3,9 +3,8 @@ Description=DBMail Sieve Server
After=syslog.target network.target mysqld.service postgresql.service
[Service]
Type=forking
PIDFile=@piddir@/dbmail-timsieved.pid
ExecStart=@sbindir@/dbmail-timsieved -p @piddir@/dbmail-timsieved.pid
Type=notify
ExecStart=@sbindir@/dbmail-timsieved -D
[Install]
WantedBy=multi-user.target

0 comments on commit c6773f6

Please sign in to comment.