diff options
Diffstat (limited to 'testing/rspamd/rspamd.initd')
| -rw-r--r-- | testing/rspamd/rspamd.initd | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/testing/rspamd/rspamd.initd b/testing/rspamd/rspamd.initd index 93148ccb4b..79e9d0d910 100644 --- a/testing/rspamd/rspamd.initd +++ b/testing/rspamd/rspamd.initd @@ -1,14 +1,19 @@ #!/sbin/openrc-run description="Rapid spam filtering system" -user=${user:-rspamd} -group=${group:-rspamd} -cfgfile=${cfgfile:-/etc/rspamd/rspamd.conf} -pidfile=${pidfile:-/run/rspamd/rspamd.pid} + +: ${user:=${RSPAMD_USER:-rspamd}} +: ${group:=${RSPAMD_GROUP:-rspamd}} +: ${cfgdir:=${RSPAMD_CONFDIR:-/etc/rspamd}} +: ${cfgfile:=${RSPAMD_CONFIG:-$cfgdir/rspamd.conf}} +: ${pidfile:=${RSPAMD_PIDFILE:-/run/$RC_SVCNAME/rspamd.pid}} + command=/usr/sbin/rspamd command_args="-u $user -g $group -c $cfgfile -p $pidfile" required_files="$cfgfile" +extra_commands="checkconfig" extra_started_commands="reload reopen" +description_checkconfig="Verify configuration" description_reload="Reload configuration" description_reopen="Reopen log files" @@ -17,21 +22,25 @@ depend() { before mta } -start_pre() { - ebegin - checkpath --directory --mode 750 --owner $user:$group ${pidfile%/*} - $command $command_args -t >/dev/null 2>>${startuplog:-/dev/null} +checkconfig() { + ebegin "Checking $RC_SVCNAME config" + $command $command_args -t eend $? } +start_pre() { + checkpath -d -m 750 -o $user:$group ${pidfile%/*} + checkconfig >/dev/null 2>>${startuplog:=${RSPAMD_STARTUPLOG:-/dev/null}} +} + reload() { - ebegin "Reloading ${SVCNAME}" - start-stop-daemon --signal HUP --pidfile $pidfile + ebegin "Reloading $RC_SVCNAME config" + checkconfig >/dev/null 2>&1 && start-stop-daemon --signal HUP --pidfile $pidfile eend $? } reopen() { - ebegin "Reopening ${SVCNAME} log files" + ebegin "Reopening $RC_SVCNAME log files" start-stop-daemon --signal USR1 --pidfile $pidfile eend $? } |
