aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils/bareos-server/files/bareos-sd.in
blob: 9c9df6de204b82630c67f52f6208b89be825a883 (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
#!/bin/sh
#
# $FreeBSD: head/sysutils/bacula5-server/files/bacula-sd.in 323486 2013-07-22 17:51:39Z rm $
#
# PROVIDE: bareos_sd
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# bareos_sd_enable  (bool):  Set to NO by default.
#               Set it to YES to enable bareos_sd.
# bareos_sd_flags (params):  Set params used to start bareos_sd.
# bareos_sd_config (params): Path to the config file/directory
#

. /etc/rc.subr

name="bareos_sd"
rcvar=${name}_enable

load_rc_config $name

: ${bareos_sd_enable="NO"}
: ${bareos_sd_flags="-u bareos -g bareos -v"}
: ${bareos_sd_config="%%PREFIX%%/etc/bareos/"}
: ${bareos_sd_pidfile="/var/run/bareos/bareos-sd.9103.pid"}

command=%%PREFIX%%/sbin/bareos-sd
command_args="-c ${bareos_sd_config}"
pidfile="${bareos_sd_pidfile}"
start_precmd="bareos_start_precmd"

bareos_start_precmd() {
    [ -d "${pidfile%/*}" ] || install -d -o bareos -g bareos ${pidfile%/*}
}

run_rc_command "$1"