/etc/init.d/pcsd is in pcs 0.9.149-1.
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 | #!/bin/sh
##
# pcsd Pacemaker & Corosync configuration daemon
#
# chkconfig: - 21 81
# description: Pacemaker & Corosync configuration daemon
### BEGIN INIT INFO
# Provides: pcsd
# Required-Start: $remote_fs $network $syslog
# Required-Stop: $remote_fs $network $syslog
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts and stops Pacemaker & Corosync daemon
# Description: Starts and stops Pacemaker & Corosync daemon
### END INIT INFO
# PATH
PATH=/usr/sbin:/usr/bin:/sbin:/bin
DESC="pcs daemon"
NAME=pcsd
EXEC=ruby
SUB_EXEC=/usr/share/pcsd/ssl.rb
DAEMON_USER=root
DAEMON=/usr/bin/ruby
DAEMON_ARGS="-C/var/lib/pcsd -I/usr/share/pcsd -- /usr/share/pcsd/ssl.rb"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
LOGFILE=/var/log/$NAME/$NAME.log
SLEEP_DURATION=2
# Exit if ruby is not installed
[ -x $(which $EXEC) ] || echo "$EXEC was not found. Is it installed?"
[ -x $(which $SUB_EXEC) ] || echo "$SUB_EXEC not found. Is pcs installed?"
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Source lsb init functions
. /lib/lsb/init-functions
is_running()
{
# Test whether pid file exists or not
test -f $PIDFILE || return 1
# Test whether process is running or not
read PID < "$PIDFILE"
ps -p $PID >/dev/null 2>&1 || return 1
# Is running
return 0
}
root_only()
{
if [ "$(id -u)" != "0" ]; then
echo "Only root should run this operation"
exit 1
fi
}
run()
{
if is_running; then
PID="$(cat $PIDFILE)"
echo "Daemon is already running as PID $PID"
return 1
fi
nohup $DAEMON $DAEMON_ARGS > /dev/null 2>&1
echo $! > $PIDFILE
read PID < "$PIDFILE"
echo "PID is $PID"
sleep $SLEEP_DURATION
if ! is_running; then
echo "Daemon died immediately after starting. Please check your logs and configurations."
return 1
fi
echo "Daemon is running as PID $PID"
return 0
}
stop()
{
if is_running; then
read PID < "$PIDFILE"
kill -9 $PID
fi
sleep $SLEEP_DURATION
if is_running; then
while is_running; do
echo "waiting for daemon to die (PID $PID)"
sleep $SLEEP_DURATION
done
fi
# Be sure to remove the pid file
rm -f "$PIDFILE"
return 0
}
case "$1" in
start)
root_only
log_daemon_msg "Starting $DESC" "$NAME"
run
log_end_msg $?
;;
stop)
root_only
log_daemon_msg "Stopping $DESC" "$NAME"
stop
log_end_msg $?
;;
restart|force-reload)
log_daemon_msg "Restarting $DESC" "$NAME"
root_only
$0 stop && $0 start
;;
status|monitor)
status_of_proc \
-p "$PIDFILE" \
"$SUB_EXEC" \
"$NAME" \
&& exit 0 \
|| exit $?
;;
*)
echo "Usage: $0 {start|stop|restart|reload|force-reload|status|monitor}"
exit 1
;;
esac
:
|