/etc/init.d/garb is in galera-arbitrator-3 25.3.14-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 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 | #!/bin/bash
#
# Copyright (C) 2012-2015 Codership Oy <info@codership.com>
#
# init.d script for garbd
#
# chkconfig: - 99 01
# config: /etc/sysconfig/garb | /etc/default/garb
### BEGIN INIT INFO
# Provides: garb
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: $network $named $time
# Should-Stop: $network $named $time
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Galera Arbitrator Daemon
# Description: The Galera Arbitrator is used as part of clusters
# that have only two real Galera servers and need an
# extra node to arbitrate split brain situations.
### END INIT INFO
# On Debian Jessie, avoid redirecting calls to this script to 'systemctl start'
_SYSTEMCTL_SKIP_REDIRECT=true
# Source function library.
if [ -f /etc/redhat-release ]; then
. /etc/init.d/functions
. /etc/sysconfig/network
config=/etc/sysconfig/garb
else
. /lib/lsb/init-functions
config=/etc/default/garb
fi
log_failure() {
if [ -f /etc/redhat-release ]; then
echo -n $*
failure "$*"
echo
else
log_failure_msg "$*"
fi
}
PIDFILE=/var/run/garbd
prog=$(which garbd)
program_start() {
local rcode
if [ -f /etc/redhat-release ]; then
echo -n $"Starting $prog: "
daemon --user nobody $prog "$@" >/dev/null
rcode=$?
if [ $rcode -eq 0 ]; then
pidof $prog > $PIDFILE || rcode=$?
fi
[ $rcode -eq 0 ] && echo_success || echo_failure
echo
else
log_daemon_msg "Starting $prog: "
start-stop-daemon --start --quiet -c nobody --background \
--exec $prog -- "$@"
rcode=$?
# Hack: sleep a bit to give garbd some time to fork
sleep 1
if [ $rcode -eq 0 ]; then
pidof $prog > $PIDFILE || rcode=$?
fi
log_end_msg $rcode
fi
return $rcode
}
program_stop() {
local rcode
if [ -f /etc/redhat-release ]; then
echo -n $"Shutting down $prog: "
killproc -p $PIDFILE
rcode=$?
[ $rcode -eq 0 ] && echo_success || echo_failure
else
start-stop-daemon --stop --quiet --oknodo --retry TERM/30/KILL/5 \
--pidfile $PIDFILE
rcode=$?
log_end_msg $rcode
fi
[ $rcode -eq 0 ] && rm -f $PIDFILE
return $rcode
}
program_status() {
if [ -f /etc/redhat-release ]; then
status $prog
else
status_of_proc -p $PIDFILE "$prog" garb
fi
}
start() {
[ "$EUID" != "0" ] && return 4
[ "$NETWORKING" = "no" ] && return 1
if grep -q -E '^# REMOVE' $config; then
log_failure "Garbd config $config is not configured yet"
return 0
fi
if [ -r $PIDFILE ]; then
local PID=$(cat ${PIDFILE})
if ps -p $PID >/dev/null 2>&1; then
log_failure "$prog is already running with PID $PID"
return 3 # ESRCH
else
rm -f $PIDFILE
fi
fi
[ -x $prog ] || return 5
[ -f $config ] && . $config
# Check that node addresses are configured
if [ -z "$GALERA_NODES" ]; then
log_failure "List of GALERA_NODES is not configured"
return 6
fi
if [ -z "$GALERA_GROUP" ]; then
log_failure "GALERA_GROUP name is not configured"
return 6
fi
GALERA_PORT=${GALERA_PORT:-4567}
OPTIONS="-d -a gcomm://${GALERA_NODES// /,}"
# substitute space with comma for backward compatibility
[ -n "$GALERA_GROUP" ] && OPTIONS="$OPTIONS -g '$GALERA_GROUP'"
[ -n "$GALERA_OPTIONS" ] && OPTIONS="$OPTIONS -o '$GALERA_OPTIONS'"
[ -n "$LOG_FILE" ] && OPTIONS="$OPTIONS -l '$LOG_FILE'"
eval program_start $OPTIONS
}
stop() {
[ "$EUID" != "0" ] && return 4
[ -r $PIDFILE ] || return 3 # ESRCH
program_stop
}
restart() {
stop
start
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
program_status
;;
restart|reload|force-reload)
restart
;;
condrestart)
if status $prog > /dev/null; then
stop
start
fi
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload}"
exit 2
esac
|