#!/bin/sh # # PROVIDE: cbsdd # REQUIRE: LOGIN FILESYSTEMS sshd # KEYWORD: shutdown # # cbsdd_enable="YES" # . /etc/rc.subr name=cbsdd rcvar=cbsdd_enable load_rc_config $name : ${cbsdd_enable="NO"} export workdir="${cbsd_workdir}" export NO_CBSD_HISTORY=yes globalconf=${cbsd_globalconf:-"${workdir}/cbsd.conf"} if [ ! -f ${globalconf} ]; then echo "cbsd: no such ${globalconf}"; exit 1 fi if [ ! -f ${mdtools} ]; then echo "cbsd: no such ${mdtools}"; exit 1 fi if [ ! -f ${subr} ]; then echo "cbsd: no such ${subr}"; exit 1 fi if [ ! -f ${localcbsdconf} ]; then echo "cbsd: no such ${localcbsdconf}"; exit 1 fi . ${globalconf} . ${mdtools} . ${subr} . ${localcbsdconf} start_precmd=${name}_prestart stop_precmd=${name}_prestop stop_cmd=${name}_stop reload_cmd=${name}_reload extra_commands="reload" command="${toolsdir}/cbsdd" pidfile="/var/run/$name.pid" command_args="&" cbsdd_prestart() { %%PREFIX%%/bin/cbsd task mode=flushall > /dev/null 2>&1 %%PREFIX%%/bin/cbsd sysinv mode=update %%PREFIX%%/bin/cbsd netinv . ${inventory} [ -n "$nat_enable" ] && %%PREFIX%%/bin/cbsd naton /usr/sbin/daemon -f ${rcddir}/jails-astart start } cbsdd_prestop() { ${rcddir}/jails-astart stop [ -n "${nat_enable}" ] && %%PREFIX%%/bin/cbsd natoff } cbsdd_stop() { [ -f "${pidfile}" ] && kill -9 $( cat ${pidfile} ) } cbsdd_reload() { [ -f "${pidfile}" ] && kill -9 $( cat ${pidfile} ) > /dev/null 2>&1 run_rc_command "start" exit 0 } run_rc_command "$1"