#!/bin/sh # # $FreeBSD$ # # PROVIDE: rspamd # REQUIRE: LOGIN # KEYWORD: shutdown # # Add the following line to /etc/rc.conf to enable rspamd: # # rspamd_enable (bool): Set to "NO" by default. # Set it to "YES" to enable rspamd. # # rspamd_user (str): Default to "nobody". # # rspamd_group (str): Default to "nobody". # # rspamd_flags (str): Default to "-c %%PREFIX%%/etc/rspamd.xml". . /etc/rc.subr name=rspamd rcvar=`set_rcvar` command=%%PREFIX%%/bin/rspamd restart_precmd="rspamd_checkconfig" reload_precmd="rspamd_checkconfig" configtest_cmd="rspamd_checkconfig" reopenlog_cmd="reopenlog_cmd" pidfile="$rspamd_pidfile" required_files=%%PREFIX%%/etc/rspamd.xml load_rc_config $name : ${rspamd_enable="NO"} : ${rspamd_pidfile="/var/run/rspamd/rspamd.pid"} : ${rspamd_user="nobody"} : ${rspamd_group="nobody"} : ${rspamd_flags="-c %%PREFIX%%/etc/rspamd.xml"} stop_postcmd="rm -f $rspamd_pidfile" rspamd_checkconfig() { echo "Performing sanity check on rspamd configuration:" eval ${command} -t } reopenlog_cmd() { pkill -USR1 -F $rspamd_pidfile } sig_reload="HUP" command_args="-u ${rspamd_user} -g ${rspamd_group}" extra_commands="reload configtest reopenlog" run_rc_command "$1"