aboutsummaryrefslogtreecommitdiff
path: root/sysutils/puppet/files/puppetmasterd.in
blob: 230b551d453714335ade1c1f845cbfabcc132162 (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
42
43
44
45
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: puppetmasterd
# REQUIRE: NETWORK

# Add the following lines to /etc/rc.conf to enable puppetmasterd:
#
# puppetmasterd_enable="YES"
# puppetmasterd_confdir:	Set to %%PREFIX%%/etc/puppet by default
# puppetmasterd_flags:		Set to "--pidfile ${puppetmasterd_pid}" by default
#

. /etc/rc.subr

name="puppetmasterd"
rcvar=`set_rcvar`

command="%%PREFIX%%/sbin/${name}"
command_interpreter="%%PREFIX%%/bin/ruby18"
start_precmd="puppetmasterd_checkconfig"
restart_precmd="puppetmasterd_checkconfig"

puppetmasterd_checkconfig() {
	echo -n "Performing sanity check of ${name} configuration: "
	${command} --parseonly ${puppetmasterd_flags} >/dev/null 2>&1
	rv=$?
	if [ $rv != 0 ]; then
		echo "FAILED, ${name} exited with status ${rv}"
		${command} --parseonly ${puppetmasterd_flags}
		return 1
	else
		echo "OK"
	fi
}

load_rc_config "$name"
: ${puppetmasterd_enable="NO"}
: ${puppetmasterd_confdir="%%PREFIX%%/etc/puppet"}
: ${puppetmasterd_pid="%%PUPPET_RUNDIR%%/${name}.pid"}
: ${puppetmasterd_flags="--pidfile ${puppetmasterd_pid}"}
pidfile="$puppetmasterd_pid"

run_rc_command "$1"