At present, I just need to restart the haproxy command, I found that the program can not get up and stop running
systemctl reload haproxy
Occurred error:
root@korea:~# systemctl status haproxy
● haproxy.service - SYSV: HA-Proxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments.
Loaded: loaded (/etc/init.d/haproxy; generated; vendor preset: enabled)
Active: failed (Result: signal) since Thu 2019-08-01 15:21:53 CDT; 14s ago
Docs: man:systemd-sysv-generator(8)
Process: 3141 ExecStop=/etc/init.d/haproxy stop (code=exited, status=3)
Process: 3133 ExecReload=/etc/init.d/haproxy reload (code=exited, status=0/SUCCESS)
Main PID: 3140 (code=killed, signal=KILL)
Tasks: 1 (limit: 4915)
CGroup: /system.slice/haproxy.service
└─27903 /usr/sbin/haproxy -D -f /etc/haproxy/haproxy.cfg -p /var/run/haproxy.pid
Aug 01 15:21:53 korea.vps.com haproxy[3141]: /etc/init.d/haproxy: 6: /etc/network/interfaces: auto: not found
Aug 01 15:21:53 korea.vps.com haproxy[3141]: /etc/init.d/haproxy: 7: /etc/network/interfaces: iface: not found
Aug 01 15:21:53 korea.vps.com haproxy[3141]: /etc/init.d/haproxy: 8: /etc/network/interfaces: address: not found
Aug 01 15:21:53 korea.vps.com haproxy[3141]: /etc/init.d/haproxy: 9: /etc/network/interfaces: gateway: not found
Aug 01 15:21:53 korea.vps.com haproxy[3141]: /etc/init.d/haproxy: 10: /etc/network/interfaces: netmask: not found
Aug 01 15:21:53 korea.vps.com haproxy[3141]: /etc/init.d/haproxy: 11: /etc/network/interfaces: dns-nameservers: not found
Aug 01 15:21:53 korea.vps.com haproxy[3141]: Shutting down haproxy:
Aug 01 15:21:53 korea.vps.com systemd[1]: haproxy.service: Control process exited, code=exited status=3
Aug 01 15:21:53 korea.vps.com systemd[1]: haproxy.service: Unit entered failed state.
Aug 01 15:21:53 korea.vps.com systemd[1]: haproxy.service: Failed with result 'signal'.
Then I need to enable the following command before the program can start up.
sudo systemctl start haproxy
Re-execute “start” but normal:
root@korea:~# sudo systemctl status haproxy
● haproxy.service - SYSV: HA-Proxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments.
Loaded: loaded (/etc/init.d/haproxy; generated; vendor preset: enabled)
Active: active (running) since Thu 2019-08-01 15:33:20 CDT; 7s ago
Docs: man:systemd-sysv-generator(8)
Process: 3141 ExecStop=/etc/init.d/haproxy stop (code=exited, status=3)
Process: 3133 ExecReload=/etc/init.d/haproxy reload (code=exited, status=0/SUCCESS)
Process: 8894 ExecStart=/etc/init.d/haproxy start (code=exited, status=0/SUCCESS)
Main PID: 8900 (haproxy)
Tasks: 1 (limit: 4915)
CGroup: /system.slice/haproxy.service
└─8900 /usr/sbin/haproxy -D -f /etc/haproxy/haproxy.cfg -p /var/run/haproxy.pid
Aug 01 15:33:20 korea.vps.com haproxy[8894]: /etc/init.d/haproxy: 3: /etc/network/interfaces: auto: not found
Aug 01 15:33:20 korea.vps.com haproxy[8894]: /etc/init.d/haproxy: 4: /etc/network/interfaces: iface: not found
Aug 01 15:33:20 korea.vps.com haproxy[8894]: /etc/init.d/haproxy: 6: /etc/network/interfaces: auto: not found
Aug 01 15:33:20 korea.vps.com haproxy[8894]: /etc/init.d/haproxy: 7: /etc/network/interfaces: iface: not found
Aug 01 15:33:20 korea.vps.com haproxy[8894]: /etc/init.d/haproxy: 8: /etc/network/interfaces: address: not found
Aug 01 15:33:20 korea.vps.com haproxy[8894]: /etc/init.d/haproxy: 9: /etc/network/interfaces: gateway: not found
Aug 01 15:33:20 korea.vps.com haproxy[8894]: /etc/init.d/haproxy: 10: /etc/network/interfaces: netmask: not found
Aug 01 15:33:20 korea.vps.com haproxy[8894]: /etc/init.d/haproxy: 11: /etc/network/interfaces: dns-nameservers: not found
Aug 01 15:33:20 korea.vps.com haproxy[8894]: Starting haproxy:
Aug 01 15:33:20 korea.vps.com systemd[1]: Started SYSV: HA-Proxy is a TCP/HTTP reverse proxy which is particularly suited for high availability en
But the prompt "ExecStop=/etc/init.d/haproxy stop (code=exited, status=3)
“, I need to restart to solve this problem.”
● haproxy.service - SYSV: HA-Proxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments.
Loaded: loaded (/etc/init.d/haproxy; generated; vendor preset: enabled)
Active: active (running) since Thu 2019-08-01 15:34:43 CDT; 6s ago
Docs: man:systemd-sysv-generator(8)
Process: 9677 ExecStop=/etc/init.d/haproxy stop (code=exited, status=0/SUCCESS)
Process: 3133 ExecReload=/etc/init.d/haproxy reload (code=exited, status=0/SUCCESS)
Process: 9692 ExecStart=/etc/init.d/haproxy start (code=exited, status=0/SUCCESS)
Main PID: 9699 (haproxy)
Tasks: 1 (limit: 4915)
CGroup: /system.slice/haproxy.service
└─9699 /usr/sbin/haproxy -D -f /etc/haproxy/haproxy.cfg -p /var/run/haproxy.pid
Aug 01 15:34:43 korea.vps.com haproxy[9692]: /etc/init.d/haproxy: 3: /etc/network/interfaces: auto: not found
Aug 01 15:34:43 korea.vps.com haproxy[9692]: /etc/init.d/haproxy: 4: /etc/network/interfaces: iface: not found
Aug 01 15:34:43 korea.vps.com haproxy[9692]: /etc/init.d/haproxy: 6: /etc/network/interfaces: auto: not found
Aug 01 15:34:43 korea.vps.com haproxy[9692]: /etc/init.d/haproxy: 7: /etc/network/interfaces: iface: not found
Aug 01 15:34:43 korea.vps.com haproxy[9692]: /etc/init.d/haproxy: 8: /etc/network/interfaces: address: not found
Aug 01 15:34:43 korea.vps.com haproxy[9692]: /etc/init.d/haproxy: 9: /etc/network/interfaces: gateway: not found
Aug 01 15:34:43 korea.vps.com haproxy[9692]: /etc/init.d/haproxy: 10: /etc/network/interfaces: netmask: not found
Aug 01 15:34:43 korea.vps.com haproxy[9692]: /etc/init.d/haproxy: 11: /etc/network/interfaces: dns-nameservers: not found
Aug 01 15:34:43 korea.vps.com haproxy[9692]: Starting haproxy:
Aug 01 15:34:43 korea.vps.com systemd[1]: Started SYSV: HA-Proxy is a TCP/HTTP reverse proxy which is particularly suited for high availability en
lines 1-22/22 (END)
At present, the following two commands will not cause an error to haproxy, but reload seems to stop the program. What should I do?
$ sudo systemctl status haproxy
$ sudo systemctl restart haproxy
error !collapse!
$ sudo systemctl reload haproxy
/etc/init.d/haproxy
Debian 9
#!/bin/sh
#
# chkconfig: - 85 15
# description: HA-Proxy is a TCP/HTTP reverse proxy which is particularly suited \
# for high availability environments.
# processname: haproxy
# config: /etc/haproxy/haproxy.cfg
# pidfile: /var/run/haproxy.pid
# Script Author: Simon Matter <simon.matter@invoca.ch>
# Version: 2004060600
# Source function library.
if [ -f /lib/lsb/init-functions ] ; then
. /lib/lsb/init-functions
else
exit 0
fi
# Source networking configuration.
# . /etc/sysconfig/network
. /etc/network/interfaces
# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0
# This is our service name
BASENAME=`basename $0`
if [ -L $0 ]; then
BASENAME=`find $0 -name $BASENAME -printf %l`
BASENAME=`basename $BASENAME`
fi
BIN=/usr/sbin/$BASENAME
CFG=/etc/$BASENAME/$BASENAME.cfg
[ -f $CFG ] || exit 1
PIDFILE=/var/run/$BASENAME.pid
LOCKFILE=/var/lock/subsys/$BASENAME
RETVAL=0
start() {
quiet_check
if [ $? -ne 0 ]; then
echo "Errors found in configuration file, check it with '$BASENAME check'."
return 1
fi
echo -n "Starting $BASENAME: "
#daemon $BIN -D -f $CFG -p $PIDFILE
start_daemon $BIN -D -f $CFG -p $PIDFILE
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $LOCKFILE
return $RETVAL
}
stop() {
echo -n "Shutting down $BASENAME: "
killproc $BASENAME -USR1
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f $LOCKFILE
[ $RETVAL -eq 0 ] && rm -f $PIDFILE
return $RETVAL
}
restart() {
quiet_check
if [ $? -ne 0 ]; then
echo "Errors found in configuration file, check it with '$BASENAME check'."
return 1
fi
stop
start
}
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)
}
check() {
$BIN -c -q -V -f $CFG
}
quiet_check() {
$BIN -c -q -f $CFG
}
rhstatus() {
status $BASENAME
}
condrestart() {
[ -e $LOCKFILE ] && restart || :
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
reload)
reload
;;
condrestart)
condrestart
;;
status)
rhstatus
;;
check)
check
;;
*)
echo $"Usage: $BASENAME {start|stop|restart|reload|condrestart|status|check}"
exit 1
esac
exit $?
Another added point is that my Debian 9 does not open SELinux, which is closed.