blob: 3cc535b954c0919bcded05968feb0dbfe3b76634 (
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
|
#!/bin/sh
# PROVIDE: spread
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable spread:
#
# spread_enable="YES"
# spread_flags="<set as needed>"
#
# 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"
|