#!/bin/sh # # $FreeBSD: head/devel/gearmand/files/gearmand.in 340872 2014-01-24 00:14:07Z mat $ # # PROVIDE: gearmand # REQUIRE: LOGIN # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf.local or /etc/rc.conf # to enable this service: # # gearmand_enable (bool): Set to NO by default. # Set it to YES to enable gearmand. # gearmand_log_level (value): Set to WARNING by default. Other options are: # FATAL, ALERT, CRITICAL, ERROR, WARNING, # NOTICE, INFO, and DEBUG # gearmand_flags (value): Include other command-line arguments with # this variable. # gearmand_user (value): Set to %%USERS%% by default. # gearmand_group (value): Set to %%GROUPS%% by default. . /etc/rc.subr name=gearmand rcvar=gearmand_enable load_rc_config $name gearmand_prestart() { install -d -o ${gearmand_user} -g ${gearmand_group} -m 755 ${_piddir} install -d -o ${gearmand_user} -g ${gearmand_group} -m 755 ${_logdir} install -d -o ${gearmand_user} -g ${gearmand_group} -m 755 ${_statedir} } : ${gearmand_enable:="NO"} : ${gearmand_log_level="WARNING"} : ${gearmand_user="%%USERS%%"} : ${gearmand_group="%%GROUPS%%"} command=%%PREFIX%%/sbin/${name} _piddir=/var/run/${name} pidfile=${_piddir}/${name}.pid _logdir=/var/log/${name} logfile=${_logdir}/${name}.log _statedir=/var/db/${name} command_args="-d --verbose ${gearmand_log_level} -l ${logfile} -P ${pidfile}" start_precmd="${name}_prestart" run_rc_command "$1"