mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-17 00:44:33 +00:00
3b479bd5f5
The master process will exit with the status of the last worker. When the worker is killed with SIGTERM, it is expected to get 143 as an exit status. Therefore, we consider this exit status as normal from a systemd point of view. If it happens when not stopping, the systemd unit is configured to always restart, so it has no adverse effect. This has mostly a cosmetic effect. Without the patch, stopping HAProxy leads to the following status: ● haproxy.service - HAProxy Load Balancer Loaded: loaded (/lib/systemd/system/haproxy.service; disabled; vendor preset: enabled) Active: failed (Result: exit-code) since Fri 2018-06-22 20:35:42 CEST; 8min ago Docs: man:haproxy(1) file:/usr/share/doc/haproxy/configuration.txt.gz Process: 32715 ExecStart=/usr/sbin/haproxy -Ws -f $CONFIG -p $PIDFILE $EXTRAOPTS (code=exited, status=143) Process: 32714 ExecStartPre=/usr/sbin/haproxy -f $CONFIG -c -q $EXTRAOPTS (code=exited, status=0/SUCCESS) Main PID: 32715 (code=exited, status=143) After the patch: ● haproxy.service - HAProxy Load Balancer Loaded: loaded (/lib/systemd/system/haproxy.service; disabled; vendor preset: enabled) Active: inactive (dead) Docs: man:haproxy(1) file:/usr/share/doc/haproxy/configuration.txt.gz
36 lines
1.2 KiB
SYSTEMD
36 lines
1.2 KiB
SYSTEMD
[Unit]
|
|
Description=HAProxy Load Balancer
|
|
After=network.target
|
|
|
|
[Service]
|
|
Environment="CONFIG=/etc/haproxy/haproxy.cfg" "PIDFILE=/run/haproxy.pid"
|
|
ExecStartPre=@SBINDIR@/haproxy -f $CONFIG -c -q
|
|
ExecStart=@SBINDIR@/haproxy -Ws -f $CONFIG -p $PIDFILE
|
|
ExecReload=@SBINDIR@/haproxy -f $CONFIG -c -q
|
|
ExecReload=/bin/kill -USR2 $MAINPID
|
|
KillMode=mixed
|
|
Restart=always
|
|
SuccessExitStatus=143
|
|
Type=notify
|
|
|
|
# The following lines leverage SystemD's sandboxing options to provide
|
|
# defense in depth protection at the expense of restricting some flexibility
|
|
# in your setup (e.g. placement of your configuration files) or possibly
|
|
# reduced performance. See systemd.service(5) and systemd.exec(5) for further
|
|
# information.
|
|
|
|
# NoNewPrivileges=true
|
|
# ProtectHome=true
|
|
# If you want to use 'ProtectSystem=strict' you should whitelist the PIDFILE,
|
|
# any state files and any other files written using 'ReadWritePaths' or
|
|
# 'RuntimeDirectory'.
|
|
# ProtectSystem=true
|
|
# ProtectKernelTunables=true
|
|
# ProtectKernelModules=true
|
|
# ProtectControlGroups=true
|
|
# If your SystemD version supports them, you can add: @reboot, @swap, @sync
|
|
# SystemCallFilter=~@cpu-emulation @keyring @module @obsolete @raw-io
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|