# Haproxy seamless reload by changing unit file

**URL:** <https://discourse.haproxy.org/t/haproxy-seamless-reload-by-changing-unit-file/5100>\
**Category:** Help!\
**Created:** [April 20, 2020, 12:07pm UTC](https://discourse.haproxy.org/t/haproxy-seamless-reload-by-changing-unit-file/5100 "2020-04-20T12:07:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![barapapupi](https://avatars.discourse-cdn.com/v4/letter/b/e79b87/32.png) [@barapapupi](https://discourse.haproxy.org/u/barapapupi)\
**Post date:** [April 20, 2020, 12:07pm UTC](https://discourse.haproxy.org/t/haproxy-seamless-reload-by-changing-unit-file/5100/1 "2020-04-20T12:07:42Z")

</div>

Hi, I have the following haproxy systemd unit file  
Just the defaults.  
[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

[Install]  
WantedBy=multi-user.target

So just the defaults from version 1.8

using systemctl reload haproxy.service works fine and reloads a new process.  
However I would like to change the unit file to do  
Environment=“CONFIG=/etc/haproxy/haproxy\_new.cfg” “PIDFILE=/run/haproxy.pid”

and then reload, after doing a daemon-reload.  
However when I check the process running, its always running with the old /etc/haproxy/haproxy.cfg and not with the new /etc/haproxy/haproxy\_new.cfg

I understand that this is not conventional, but I’m required to stick to creating a new config file and recreate the unit file and then do a reload.  
Can someone help me on how to achieve the above?

---

<div class="post-metadata">

**Author:** ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)\
**Post date:** [April 20, 2020, 9:55pm UTC](https://discourse.haproxy.org/t/haproxy-seamless-reload-by-changing-unit-file/5100/2 "2020-04-20T21:55:53Z")

</div>

Did you check whether the new configuration is actually applied, or did you just review the ps output?

---

<div class="post-metadata">

**Author:** ![barapapupi](https://avatars.discourse-cdn.com/v4/letter/b/e79b87/32.png) [@barapapupi](https://discourse.haproxy.org/u/barapapupi)\
**Post date:** [April 20, 2020, 11:59pm UTC](https://discourse.haproxy.org/t/haproxy-seamless-reload-by-changing-unit-file/5100/3 "2020-04-20T23:59:32Z")

</div>

Initially I just reviewed the output of ps.  
After your ask, I checked the configuration being served, and its still the original  
Since it looks like this  
ExecReload=@SBINDIR@/haproxy -f $CONFIG -c -q  
ExecReload=/bin/kill -USR2 $MAINPID

just checks the config for validity and kills the MAINPID, which triggers a new worker to spring up.  
But from the original master who was using haproxy.cfg and not haproxy\_new.cfg.

If I do systemctl daemon-reload and systemctl restart haproxy.service, only then I see the process and requests being served by the new haproxy\_new.cfg
