HAProxy community

Systemctl reload not working - fails to start/stop

I’m having an issue with reloads with Haproxy 1.8.16 with Centos7.

I am using init scripts for the start/stop/reload/restart functions, and have tried following https://www.haproxy.com/blog/hitless-reloads-with-haproxy-howto/ this info, but I just can’t seem to get it to work.
This is my init script reload area:

reload() {
if ! [ -s $PIDFILE ]; then
return 0
fi

quiet_check
if [ $? -ne 0 ]; then
echo "Errors found in configuration file, check it with '$BASENAME check'."
return 1
fi
 $BIN -D -f $CFG -p $PIDFILE -sf $(cat $PIDFILE) -x /var/run/haproxy.sock
}

I also have

stats socket /var/run/haproxy.sock mode 600 expose-fd listeners level user
in my config file.

This shows up after a reload:

systemd[1]: haproxy.service: main process exited, code=killed, status=9/KILL
haproxy[19580]: Shutting down haproxy: [FAILED]
systemd[1]: Unit haproxy.service entered failed state.

What am I doing wrong here or misunderstanding?

EDIT: could it be that the .socks file doesn’t exist? /var/run/haproxy.sock ? Nothing is there.

Delete the init script. You are using systemd, you need to use the systemd unit file that ships with haproxy

I did a manual compilation, does that still include the systemd script?

Please follow the instructions in the following post: