diff options
Diffstat (limited to 'testing/rmilter/rmilter.initd')
-rw-r--r-- | testing/rmilter/rmilter.initd | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/testing/rmilter/rmilter.initd b/testing/rmilter/rmilter.initd new file mode 100644 index 0000000000..10ea136d36 --- /dev/null +++ b/testing/rmilter/rmilter.initd @@ -0,0 +1,45 @@ +#!/sbin/openrc-run + +description="Rapid spam defence mail filter" +user=${user:-rmilter} +group=${group:-rmilter} +cfgfile=${cfgfile:-/etc/rmilter/rmilter.conf} +pidfile=$(grep pidfile $cfgfile | cut -d = -f 2 | sed 's/[ ;]//g') +pidfile=${pidfile:-/run/rmilter/rmilter.pid} +sockfile=$(grep bind_socket $cfgfile | grep unix: | cut -d : -f 2 | sed 's/[ ;]//g') +command=/usr/sbin/rmilter +command_args="-c $cfgfile" +required_files="$cfgfile" +extra_started_commands="reload" +description_reload="Reload configuration" + +depend() { + need net dns localmount + use logger antivirus antispam +} + +start_pre() { + ebegin + checkpath --directory --mode 750 --owner $user:$group ${pidfile%/*} + if [ "$sockfile" ]; then + checkpath --directory --mode 750 --owner $user:$group ${sockfile%/*} + rm -f $sockfile + fi + eend $? +} + +start() { + ebegin "Starting ${SVCNAME}" + start-stop-daemon --start \ + --user $user \ + --group $group \ + --pidfile $pidfile \ + --exec $command -- $command_args + eend $? +} + +reload() { + ebegin "Reloading ${SVCNAME}" + start-stop-daemon --signal USR1 --pidfile $pidfile + eend $? +} |