prepare to merge with pyquarantine project
This commit is contained in:
46
pyquarantine/misc/openrc/pyquarantine-milter.initd
Executable file
46
pyquarantine/misc/openrc/pyquarantine-milter.initd
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
user=${USER:-daemon}
|
||||
milter_opts="${MILTER_OPTS:-}"
|
||||
|
||||
pidfile="/run/${RC_SVCNAME}.pid"
|
||||
command="/usr/bin/pyquarantine-milter"
|
||||
command_args="${milter_opts}"
|
||||
command_background=true
|
||||
command_user="${user}"
|
||||
extra_commands="configtest"
|
||||
start_stop_daemon_args="--wait 500"
|
||||
|
||||
depend() {
|
||||
need net
|
||||
before mta
|
||||
}
|
||||
|
||||
checkconfig() {
|
||||
OUTPUT=$( ${command} ${command_args} -t 2>&1 )
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]; then
|
||||
eerror "${SVCNAME} has detected an error in your configuration:"
|
||||
printf "%s\n" "${OUTPUT}"
|
||||
fi
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
configtest() {
|
||||
ebegin "Checking ${SVCNAME} configuration"
|
||||
checkconfig
|
||||
eend $?
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
if [ "${RC_CMD}" != "restart" ]; then
|
||||
checkconfig || return $?
|
||||
fi
|
||||
}
|
||||
|
||||
stop_pre() {
|
||||
if [ "${RC_CMD}" == "restart" ]; then
|
||||
checkconfig || return $?
|
||||
fi
|
||||
}
|
||||
Reference in New Issue
Block a user