From 70c2580fdc38582e108bd759cb524829d3ff848b Mon Sep 17 00:00:00 2001 From: Janos SUTO Date: Sat, 14 Jul 2018 12:57:08 +0000 Subject: [PATCH] Added systemd support Signed-off-by: Janos SUTO --- configure | 3 ++- configure.in | 2 +- systemd/Makefile.in | 39 +++++++++++++++++++++++++++++++++++++ systemd/piler-smtp.service | 15 ++++++++++++++ systemd/piler.service | 16 +++++++++++++++ systemd/pilersearch.service | 18 +++++++++++++++++ 6 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 systemd/Makefile.in create mode 100644 systemd/piler-smtp.service create mode 100644 systemd/piler.service create mode 100644 systemd/pilersearch.service diff --git a/configure b/configure index a33e6650..f5801c40 100755 --- a/configure +++ b/configure @@ -4848,7 +4848,7 @@ CFLAGS="$static -O2 -Wall -g" LIBS="$antispam_libs $sunos_libs " OBJS="dirs.o base64.o misc.o counters.o cfg.o sig.o decoder.o hash.o parser.o parser_utils.o rules.o smtp.o session.o bdat.o message.o attachment.o digest.o store.o archive.o tai.o import.o import_maildir.o import_mailbox.o import_pop3.o import_imap.o imap.o pop3.o extract.o mydomains.o $objs" -ac_config_files="$ac_config_files Makefile src/Makefile etc/Makefile util/Makefile init.d/Makefile unit_tests/Makefile webui/Makefile contrib/imap/Makefile" +ac_config_files="$ac_config_files Makefile src/Makefile etc/Makefile util/Makefile init.d/Makefile systemd/Makefile unit_tests/Makefile webui/Makefile contrib/imap/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -5546,6 +5546,7 @@ do "etc/Makefile") CONFIG_FILES="$CONFIG_FILES etc/Makefile" ;; "util/Makefile") CONFIG_FILES="$CONFIG_FILES util/Makefile" ;; "init.d/Makefile") CONFIG_FILES="$CONFIG_FILES init.d/Makefile" ;; + "systemd/Makefile") CONFIG_FILES="$CONFIG_FILES systemd/Makefile" ;; "unit_tests/Makefile") CONFIG_FILES="$CONFIG_FILES unit_tests/Makefile" ;; "webui/Makefile") CONFIG_FILES="$CONFIG_FILES webui/Makefile" ;; "contrib/imap/Makefile") CONFIG_FILES="$CONFIG_FILES contrib/imap/Makefile" ;; diff --git a/configure.in b/configure.in index 88887ea2..553aab8f 100644 --- a/configure.in +++ b/configure.in @@ -534,7 +534,7 @@ CFLAGS="$static -O2 -Wall -g" LIBS="$antispam_libs $sunos_libs " OBJS="dirs.o base64.o misc.o counters.o cfg.o sig.o decoder.o hash.o parser.o parser_utils.o rules.o smtp.o session.o bdat.o message.o attachment.o digest.o store.o archive.o tai.o import.o import_maildir.o import_mailbox.o import_pop3.o import_imap.o imap.o pop3.o extract.o mydomains.o $objs" -AC_CONFIG_FILES([Makefile src/Makefile etc/Makefile util/Makefile init.d/Makefile unit_tests/Makefile webui/Makefile contrib/imap/Makefile]) +AC_CONFIG_FILES([Makefile src/Makefile etc/Makefile util/Makefile init.d/Makefile systemd/Makefile unit_tests/Makefile webui/Makefile contrib/imap/Makefile]) AC_OUTPUT echo diff --git a/systemd/Makefile.in b/systemd/Makefile.in new file mode 100644 index 00000000..8d81d820 --- /dev/null +++ b/systemd/Makefile.in @@ -0,0 +1,39 @@ +SHELL = @SHELL@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +sbindir = @sbindir@ +includedir = @includedir@ +libdir = @libdir@ +libexecdir = @libexecdir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +mandir = @mandir@ +datarootdir = @datarootdir@ +localstatedir = @localstatedir@ + +CC = @CC@ +CFLAGS = @CFLAGS@ @CPPFLAGS@ +DEFS = @defs@ +INCDIR = -I. -I../.. -I../../src @INCDIR@ @sql_includes@ +LIBDIR = -L. @LIBDIR@ @LDFLAGS@ -L../../src +LIBS = @LIBS@ @sql_libs@ +RUNNING_USER = @RUNNING_USER@ +RUNNING_GROUP = `@id_bin@ -gn $(RUNNING_USER)` + +INSTALL = @INSTALL@ + +all: + echo all + +install: + $(INSTALL) -m 0644 $(srcdir)/piler.service $(DESTDIR)$(libexecdir)/piler/piler.service + $(INSTALL) -m 0644 $(srcdir)/piler-smtp.service $(DESTDIR)$(libexecdir)/piler/piler-smtp.service + $(INSTALL) -m 0644 $(srcdir)/pilersearch.service $(DESTDIR)$(libexecdir)/piler/pilersearch.service + +clean: + echo clean + +distclean: clean + rm -f Makefile diff --git a/systemd/piler-smtp.service b/systemd/piler-smtp.service new file mode 100644 index 00000000..568ef66f --- /dev/null +++ b/systemd/piler-smtp.service @@ -0,0 +1,15 @@ +[Unit] +Description=Piler SMTP server +After=network.target auditd.service + +[Service] +ExecStart=/usr/sbin/piler-smtp -d +KillMode=process +Restart=on-failure +RestartPreventExitStatus=255 +Type=forking +User=root + +[Install] +WantedBy=multi-user.target +Alias=piler-smtp.service diff --git a/systemd/piler.service b/systemd/piler.service new file mode 100644 index 00000000..755f7c39 --- /dev/null +++ b/systemd/piler.service @@ -0,0 +1,16 @@ +[Unit] +Description=Piler daemon +After=network.target mariadb.service + +[Service] +ExecStart=/usr/sbin/piler -d +PIDFile=/var/run/piler/piler.pid +KillMode=process +Restart=on-failure +RestartPreventExitStatus=255 +Type=forking +User=root + +[Install] +WantedBy=multi-user.target +Alias=piler.service diff --git a/systemd/pilersearch.service b/systemd/pilersearch.service new file mode 100644 index 00000000..972227f9 --- /dev/null +++ b/systemd/pilersearch.service @@ -0,0 +1,18 @@ +[Unit] +Description=Searchd for piler daemon +After=network.target mariadb.service + +[Service] +ExecStart=/usr/bin/searchd --config /etc/piler/sphinx.conf +ExecStartPre=/bin/bash -c "if [[ ! -d /var/run/piler ]]; then mkdir -p /var/run/piler; chown piler:piler /var/run/piler; fi" +PIDFile=/var/run/piler/searchd.pid +KillMode=process +Restart=on-failure +RestartPreventExitStatus=255 +Type=forking +User=piler + + +[Install] +WantedBy=multi-user.target +Alias=pilersearch.service