summaryrefslogtreecommitdiffstats
path: root/conf/redhat/server.init
blob: b64622140922f86821792df49684e98b1939aa7c (plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
# puppetmaster  This shell script enables the puppetmaster server.
#
# Author:       Duane Griffin <d.griffin@psenterprise.com>
#
# chkconfig: - 65 45
#
# description: Server for the puppet system management tool.
# processname: puppetmaster

PATH=/usr/bin:/sbin:/bin:/usr/sbin
export PATH

lockfile=/var/lock/subsys/puppetmaster

# Source function library.
. /etc/rc.d/init.d/functions

if [ -f /etc/sysconfig/puppetmaster ]; then
	. /etc/sysconfig/puppetmaster
fi

PUPPETMASTER_OPTS=""
[ -n "$PUPPETMASTER_MANIFEST" ] && PUPPETMASTER_OPTS="--manifest=${PUPPETMASTER_MANIFEST}"
[ -n "$PUPPETMASTER_LOG" ] && PUPPETMASTER_OPTS="${PUPPETMASTER_OPTS} --logdest=${PUPPETMASTER_LOG}"
PUPPETMASTER_OPTS="${PUPPETMASTER_OPTS} \
	${PUPPETMASTER_EXTRA_OPTS}"

RETVAL=0

prog=puppetmasterd
PUPPETMASTER=/usr/sbin/$prog

start() {
	echo -n $"Starting puppetmaster: "

	# Confirm the manifest exists
	if [ -r $PUPPETMASTER_MANIFEST ]; then
		daemon $PUPPETMASTER $PUPPETMASTER_OPTS
		RETVAL=$?
	else
		failure $"Manifest does not exist: $PUPPETMASTER_MANIFEST"
		echo
		return 1
	fi
	[ $RETVAL -eq 0 ] && touch "$lockfile"
	echo
	return $RETVAL
}

stop() {
	echo -n  $"Stopping puppetmaster: "
	killproc $PUPPETMASTER
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f "$lockfile"
	return $RETVAL
}

restart() {
  stop
  start
}

case "$1" in
  start)
	start
	;;
  stop) 
	stop
	;;
  restart|reload|force-reload)
        restart
	;;
  condrestart)
	[ -f "$lockfile" ] && restart
	;;
  status)
	status $PUPPETMASTER
        RETVAL=$?
	;;
  *)
	echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"
	exit 1
esac

exit $RETVAL