This file is indexed.

/etc/init.d/pacemaker is in pacemaker 1.1.10+git20130802-1ubuntu2.4.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
#!/bin/bash

# Authors:
#  Andrew Beekhof <abeekhof@redhat.com>
#  Fabio M. Di Nitto <fdinitto@redhat.com>
#
# License: Revised BSD

# chkconfig: - 99 01
# description: Pacemaker Cluster Manager
# processname: pacemakerd
#
### BEGIN INIT INFO
# Provides:		pacemaker
# Required-Start:	$network corosync
# Should-Start:		$syslog
# Required-Stop:	$network corosync
# Default-Start:  2 3 4 5
# Default-Stop:   0 1 6
# Short-Description:	Starts and stops Pacemaker Cluster Manager.
# Description:		Starts and stops Pacemaker Cluster Manager.
### END INIT INFO

desc="Pacemaker Cluster Manager"
prog="pacemakerd"
cman=0

# set secure PATH
PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/sbin"

checkrc() {
    if [ $? = 0 ]; then
	success
    else
	failure
    fi
}

success()
{
	echo -ne "[  OK  ]\r"
}

failure()
{
	echo -ne "[FAILED]\r"
}

status()
{
	pid=$(pidof $1 2>/dev/null)
	rtrn=$?
	if [ $rtrn -ne 0 ]; then
		echo "$1 is stopped"
	else
		echo "$1 (pid $pid) is running..."
	fi
	return $rtrn
}

# rpm based distros
if [ -d /etc/sysconfig ]; then
	[ -f /etc/init.d/functions ] && . /etc/init.d/functions
	[ -f /etc/sysconfig/pacemaker ] && . /etc/sysconfig/pacemaker
	[ -z "$LOCK_FILE" ] && LOCK_FILE="/var/lock/subsys/pacemaker"
fi

# deb based distros
if [ -d /etc/default ]; then
	[ -f /etc/default/pacemaker ] && . /etc/default/pacemaker
	[ -z "$LOCK_FILE" ] && LOCK_FILE="/var/lock/pacemaker"
fi

# Unless specified otherwise, assume cman is in use if cluster.conf exists
if [ x = "x$PCMK_STACK" -a -f /etc/cluster/cluster.conf ]; then
    PCMK_STACK=cman
fi

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

	# most recent distributions use tmpfs for $/var/run
	# to avoid to clean it up on every boot.
	# they also assume that init scripts will create
	# required subdirectories for proper operations
	mkdir -p /var/run

	if status $prog > /dev/null 2>&1; then
		success
	else
		$prog > /dev/null 2>&1 &

		# Time to connect to corosync and fail
		sleep 5

		if status $prog > /dev/null 2>&1; then
			touch $LOCK_FILE
			pidof $prog > /var/run/$prog.pid
			success
		else
			failure
			rtrn=1
		fi
	fi
	echo
}

cman_pre_start()
{
    pid=$(pidof corosync 2>/dev/null)
    if [ $? -ne 0 ]; then
	service cman start
	sleep 2
    fi
}

cman_pre_stop()
{
    pid=$(pidof fenced 2>/dev/null)
    if [ $? -ne 0 ]; then
	: CMAN is not running, nothing to do here
	return
    fi
    cname=`crm_node --name`
    crm_attribute -N $cname -n standby -v true -l reboot
    logger -t pacemaker -p daemon.notice "Waiting for shutdown of managed resources"
    echo -n "Waiting for shutdown of managed resources"

    while [ 1 = 1 ]; do
	# 0x0000000000000002 means managed
	active=`crm_resource -c | grep Resource: | grep 0x...............[2367] | awk '{print $9}' | grep $cname | wc -l`
	if [ $active = 0 ]; then
	    break;
	fi
	sleep 1
	echo -n "."
    done
    success
    echo

    logger -t pacemaker -p daemon.notice "Leaving fence domain"
    echo -n "Leaving fence domain"
    fence_tool leave -w 10
    checkrc

    logger -t pacemaker -p daemon.notice "Stopping fenced"
    fenced=$(pidof fenced)
    echo -n "Stopping fenced $fenced"
    kill -KILL $fenced > /dev/null 2>&1
    checkrc
}

stop()
{
	shutdown_prog=$prog
	if ! status $prog > /dev/null 2>&1; then
	    shutdown_prog="crmd"
	fi

	if status $shutdown_prog > /dev/null 2>&1; then
	    echo -n "Signaling $desc to terminate: "
	    kill -TERM $(pidof $prog) > /dev/null 2>&1
	    success
	    echo

	    echo -n "Waiting for cluster services to unload:"
	    while status $prog > /dev/null 2>&1; do
		sleep 1
		echo -n "."
	    done
	else
	    echo -n "$desc is already stopped"
	fi

	rm -f $LOCK_FILE
	rm -f /var/run/$prog.pid
	killall -q -9 'crmd stonithd attrd cib lrmd pacemakerd'
	success
	echo
}

rtrn=0

case "$1" in
start)
	# For consistency with stop
	[ "$PCMK_STACK" = cman ] && cman_pre_start
	start
;;
restart|reload|force-reload)
	stop
	start
;;
condrestart|try-restart)
	if status $prog > /dev/null 2>&1; then
	    stop
	    start
	fi
;;
status)
	status $prog
	rtrn=$?
;;
stop)
	#
	# stonithd needs to be around until fenced is stopped
	# fenced can't be stopped until any cluster filesystems are unmounted
	#
	# So:
	# 1. put the node into standby
	# 2. wait for all resources to be stopped
	# 3. stop fenced and anything that needs it (borrowed from the cman script)
	# 4. stop pacemaker
	# 5. stop the rest of cman (so it doesn't end up half up/down)
	#
	[ "$PCMK_STACK" = cman ] && cman_pre_stop
	stop
	[ "$PCMK_STACK" = cman ] && service cman stop
;;
*)
	echo "usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}"
	rtrn=2
;;
esac

exit $rtrn