aboutsummaryrefslogtreecommitdiff
path: root/net-p2p/rslsync/files/rslsync.in
blob: f1ea9c9d6cd95c4a37c255249c53864d9421f141 (plain) (blame)
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
#!/bin/sh

# PROVIDE: rslsync
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# rslsync_enable (bool):        Set to NO by default.
#                               Set it to YES to enable it.
# rslsync_user:        	        The user account rslsync daemon runs as
#                               what you want it to be. It uses '%%USER%%'
#                               user by default. Do not sets it as empty or it
#                               will run as root.
# rslsync_group:                The group account rslsync daemon runs as
#                               what you want it to be. It uses '%%GROUP%%'
#                               group by default. Do not sets it as empty or it
#                               will run as wheel.

. /etc/rc.subr
name="rslsync"
rcvar="${name}_enable"
load_rc_config ${name}

: ${rslsync_enable:="NO"}
: ${rslsync_user:="%%USER%%"}
: ${rslsync_group:="%%GROUP%%"}

pidfile="/var/run/rslsync/rslsync.pid"
command="%%PREFIX%%/bin/rslsync"
command_args="--config %%PREFIX%%/etc/rslsync.conf"

start_precmd=rslsync_prestart
rslsync_prestart() {
	if [ ! -d ${pidfile%/*} ]; then
		install -d -o ${rslsync_user} -g ${rslsync_group} ${pidfile%/*}
	fi
}

run_rc_command "$1"