codership / glb

Galera Load Balancer - a simple TCP connection proxy and load-balancing library
GNU General Public License v2.0
153 stars 51 forks source link

"start()" command in the start/stop script #30

Open ctmarc opened 3 years ago

ctmarc commented 3 years ago

In files/glbd.sh on line 110-115 the start() command checks the exit code of the "pidof" statement. Shouldn't it check the exit code of the preceding "eval" statement instead? (edit -- maybe not but it didnt work in my alpine container)

Additionally, the statement pidof /usr/local/sbin/glbd (pidof $exec) returns a blank string instead of a pid, but pidof $prog returns a value. Actually it returns 2 PIDs, one of which is the executable and the second is the init script, but only the first should go into the .pid file.

I replaced lines 110-115 with the following and it seems to run well:

if ! eval $exec $GLBD_OPTIONS $LISTEN_ADDR $DEFAULT_TARGETS; then
   echo "[`date`] $prog: failed to start."
   exit 1
fi
PID=`pidof -o %PPID $prog`