/usr/bin/garb-systemd is in percona-galera-arbitrator-3 3.8-3390-0ubuntu6.
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 | #!/bin/bash -ue
#
if [ -f /etc/sysconfig/garb ]; then
config=/etc/sysconfig/garb
elif [ -f /etc/default/garb ]; then
config=/etc/default/garb
else
log_failure "Garbd configuration file not found"
return 6
fi
log_failure() {
echo " ERROR! $@"
}
program_start() {
echo "Starting garbd"
/usr/bin/garbd $*
}
start() {
if grep -q -E '^# REMOVE' $config;then
log_failure "Garbd config $config is not configured yet"
return 0
fi
# 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}
# Find a working node
for ADDRESS in ${GALERA_NODES} 0; do
HOST=$(echo $ADDRESS | cut -d \: -f 1 )
PORT=$(echo $ADDRESS | cut -s -d \: -f 2 )
PORT=${PORT:-$GALERA_PORT}
if [[ -x `which nc` ]] && nc -h 2>&1 | grep -q -- '-z';then
nc -z $HOST $PORT >/dev/null && break
elif [[ -x `which nmap` ]];then
nmap -Pn -p$PORT $HOST | awk "\$1 ~ /$PORT/ {print \$2}" | grep -q open && break
else
log_failure "Neither netcat nor nmap are present for zero I/O scanning"
return 1
fi
done
if [ ${ADDRESS} == "0" ]; then
log_failure "None of the nodes in $GALERA_NODES is accessible"
return 1
fi
OPTIONS=" -a gcomm://$ADDRESS "
[ -n "${GALERA_GROUP:-}" ] && OPTIONS="$OPTIONS -g $GALERA_GROUP"
[ -n "${GALERA_OPTIONS:-}" ] && OPTIONS="$OPTIONS -o $GALERA_OPTIONS"
[ -n "${LOG_FILE:-}" ] && OPTIONS="$OPTIONS -l $LOG_FILE"
program_start $OPTIONS
}
# See how we were called.
case "$1" in
start)
start
;;
*)
echo $"Usage: $0 {start}"
exit 2
esac
exit $?
|