summaryrefslogtreecommitdiff
path: root/devel/gearmand-devel/files/gearmand.in
blob: 80d10c5826e7d57121eafc9e872b9f5d66589635 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh

# 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"