*** garb.sh.in_orig 2020-06-19 15:38:44.301646015 +0200 --- garb.sh.in 2020-06-19 15:36:37.399839986 +0200 *************** *** 19,24 **** --- 19,26 ---- # see http://www.codership.com/wiki/doku.php?id=galera_parameters # (default empty). # garb_log_file (str): Log file for garbd (default empty). Optional, by default logs to syslog + # garb_conf_file (str): Configfile for garbd (default empty) + # see https://galeracluster.com/library/kb/two-node-clusters.html # garb_pid_file (str): Custum PID file path and name. # Default to "/var/run/garb.pid". # *************** *** 36,41 **** --- 38,44 ---- : ${garb_galera_group=""} : ${garb_galera_options=""} : ${garb_log_file=""} + : ${garb_conf_file=""} : ${garb_pid_file="/var/run/garbd"} procname="/usr/local/bin/garbd" *************** *** 53,95 **** garb_prestart() { ! [ "$(id -ur)" != "0" ] && err 4 "root rights are required to start $name" ! [ -r "$garb_pid_file" ] && err 0 "$procname is already running with PID $(cat $garb_pid_file)" ! [ -x "$procname" ] || err 5 "$procname is not found" ! ! # check that node addresses are configured ! [ -z "$garb_galera_nodes" ] && err 6 "List of garb_galera_nodes is not configured" ! [ -z "$garb_galera_group" ] && err 6 "garb_galera_group name is not configured" ! ! GALERA_PORT=${GALERA_PORT:-4567} ! ! # Concatenate all nodes in the list (for backward compatibility) ! ADDRESS= ! for NODE in ${garb_galera_nodes}; do ! [ -z "$ADDRESS" ] && ADDRESS="$NODE" || ADDRESS="$ADDRESS,$NODE" ! done ! ! command_args="$command_args -a gcomm://$ADDRESS" ! [ -n "$garb_galera_group" ] && command_args="$command_args -g $garb_galera_group" ! [ -n "$garb_galera_options" ] && command_args="$command_args -o $garb_galera_options" ! [ -n "$garb_log_file" ] && command_args="$command_args -l $garb_log_file" ! return 0 } garb_poststart() { ! local timeout=15 ! while [ ! -f "$garb_pid_file" -a $timeout -gt 0 ]; do ! timeout=$(( timeout - 1 )) ! sleep 1 ! done ! return 0 } garb_prestop() { ! [ "$(id -ur)" != "0" ] && err 4 "root rights are required to stop $name" ! [ -r $garb_pid_file ] || err 0 "" ! return 0 } run_rc_command "$1" --- 56,106 ---- garb_prestart() { ! [ "$(id -ur)" != "0" ] && err 4 "root rights are required to start $name" ! [ -r "$garb_pid_file" ] && err 0 "$procname is already running with PID $(cat $garb_pid_file)" ! [ -x "$procname" ] || err 5 "$procname is not found" ! ! # check that node addresses are configured ! if [ -z "$garb_conf_file" ] ! then ! [ -z "$garb_galera_nodes" ] && err 6 "List of garb_galera_nodes is not configured" ! [ -z "$garb_galera_group" ] && err 6 "garb_galera_group name is not configured" ! fi ! ! GALERA_PORT=${GALERA_PORT:-4567} ! ! # Concatenate all nodes in the list (for backward compatibility) ! ADDRESS= ! for NODE in ${garb_galera_nodes}; do ! [ -z "$ADDRESS" ] && ADDRESS="$NODE" || ADDRESS="$ADDRESS,$NODE" ! done ! ! if [ -n "$garb_conf_file" ] ! then ! command_args="$command_args -c $garb_conf_file" ! else ! command_args="$command_args -a gcomm://$ADDRESS" ! [ -n "$garb_galera_group" ] && command_args="$command_args -g $garb_galera_group" ! [ -n "$garb_galera_options" ] && command_args="$command_args -o $garb_galera_options" ! fi ! [ -n "$garb_log_file" ] && command_args="$command_args -l $garb_log_file" ! return 0 } garb_poststart() { ! local timeout=15 ! while [ ! -f "$garb_pid_file" -a $timeout -gt 0 ]; do ! timeout=$(( timeout - 1 )) ! sleep 1 ! done ! return 0 } garb_prestop() { ! [ "$(id -ur)" != "0" ] && err 4 "root rights are required to stop $name" ! [ -r $garb_pid_file ] || err 0 "" ! return 0 } run_rc_command "$1"