freebsd-ports/sysutils/bareos-server/files/bareos-fd.in
Jose Alonso Cardenas Marquez 0e97cc7e9d - Fix rc script
- Set default config file to %%PREFIX%%/etc/bareos/bareos-[dir|sd|fd].conf
  files. Set %%PREFIX%%/etc/bareos if you want to use new config style
- Remove config file test on bareos-dir rc script. It fixed a problem on
  start/boot

PR:		218126 217141
Reported by:	Joakim Jalap <joakim.jalap at fastmail.com>
		matthias at petermann-it.de
		weberge42
2017-04-21 17:47:38 +00:00

48 lines
1.2 KiB
Bash

#!/bin/sh
#
# $FreeBSD: head/sysutils/bacula5-server/files/bacula-fd.in 323275 2013-07-19 09:44:58Z rm $
#
# PROVIDE: bareos_fd
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# bareos_fd_enable (bool): Set to NO by default.
# Set it to YES to enable bareos_fd.
# bareos_fd_flags (params): Set params used to start bareos_fd.
# bareos_fd_config (params): Path to the config file/directory
#
. /etc/rc.subr
name="bareos_fd"
rcvar=${name}_enable
load_rc_config $name
: ${bareos_fd_enable="NO"}
: ${bareos_fd_flags="-u root -g wheel -v"}
: ${bareos_fd_config="%%PREFIX%%/etc/bareos/bareos-fd.conf"}
: ${bareos_fd_pidfile="/var/run/bareos/bareos-fd.9102.pid"}
command=%%PREFIX%%/sbin/bareos-fd
command_args="-c ${bareos_fd_config}"
pidfile="${bareos_fd_pidfile}"
start_precmd="bareos_start_precmd"
bareos_start_precmd() {
[ -d "${pidfile%/*}" ] || {
getent passwd bareos > /dev/null 2&>1
if [ $? -eq 0] ; then
# user bareos exists
install -d -o bareos -g bareos ${pidfile%/*}
else
# bareos_fd as solitair service
install -d -o root -g wheel ${pidfile%/*}
fi
}
}
run_rc_command "$1"