mirror of
https://git.freebsd.org/ports.git
synced 2025-06-15 17:50:31 -04:00
55 lines
1.5 KiB
Bash
55 lines
1.5 KiB
Bash
#!/bin/sh
|
|
|
|
# PROVIDE: bareos_dir
|
|
# REQUIRE: DAEMON %%REQ_MYSQL%% %%REQ_PGSQL%%
|
|
# KEYWORD: shutdown
|
|
#
|
|
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
|
|
# to enable this service:
|
|
#
|
|
# bareos_dir_enable (bool): Set to NO by default.
|
|
# Set it to YES to enable bareos_dir.
|
|
# bareos_dir_flags (params): Set params used to start bareos_dir.
|
|
# bareos_dir_config (params): Path to the config file/directory
|
|
#
|
|
|
|
. /etc/rc.subr
|
|
|
|
name="bareos_dir"
|
|
rcvar=${name}_enable
|
|
|
|
load_rc_config $name
|
|
|
|
: ${bareos_dir_enable="NO"}
|
|
: ${bareos_dir_flags="-u bareos -g bareos -v"}
|
|
: ${bareos_dir_config="%%PREFIX%%/etc/bareos/"}
|
|
: ${bareos_dir_pidfile="/var/run/bareos/bareos-dir.9101.pid"}
|
|
|
|
command=%%PREFIX%%/sbin/bareos-dir
|
|
command_args="-c ${bareos_dir_config}"
|
|
pidfile="${bareos_dir_pidfile}"
|
|
bconsole_command=/usr/local/bin/bconsole
|
|
start_precmd="bareos_start_precmd"
|
|
restart_precmd="bareos_dir_configtest"
|
|
reload_precmd="bareos_dir_configtest"
|
|
reload_cmd="bareos_dir_reload"
|
|
configtest_cmd="bareos_dir_configtest"
|
|
|
|
bareos_start_precmd() {
|
|
[ -d "${pidfile%/*}" ] || install -d -o bareos -g bareos ${pidfile%/*}
|
|
bareos_dir_configtest
|
|
}
|
|
|
|
bareos_dir_configtest() {
|
|
echo "Performing sanity check on ${bareos_dir_config} configuration:"
|
|
eval ${command} -t
|
|
}
|
|
|
|
bareos_dir_reload() {
|
|
echo "Performing a graceful reload"
|
|
# bconsole always exits with 0, so we can't check the return status for success.
|
|
echo "reload" | ${bconsole_command}
|
|
}
|
|
|
|
extra_commands="reload configtest"
|
|
run_rc_command "$1"
|