#!/bin/sh # # $FreeBSD: head/net/spread4/files/spread.in 313372 2013-03-03 18:12:06Z ohauer $ # # PROVIDE: spread # REQUIRE: LOGIN # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf to enable spread: # # spread_enable="YES" # spread_flags="" # # See spread(1) for flags . /etc/rc.subr name=spread rcvar=spread_enable load_rc_config ${name} # set defaults spread_enable=${spread_enable:-"NO"} spread_user=%%USERS%% spread_group=%%GROUPS%% command="%%PREFIX%%/sbin/spread" required_files=%%PREFIX%%/etc/${name}.conf pidfile=/var/run/${name}.pid start_cmd=spread_start stop_postcmd=spread_cleanup spread_start() { echo "Starting spread." /usr/bin/install -o ${spread_user} -g ${spread_group} -d /var/log/spread /usr/bin/touch ${pidfile} && /usr/sbin/chown ${spread_user}:${spread_group} ${pidfile} /usr/sbin/daemon -cf -p ${pidfile} -u ${spread_user} ${command} ${spread_flags} } spread_cleanup() { [ -f ${pidfile} ] && rm -f ${pidfile} } run_rc_command "$1"