DevOps Blog - Nicolas Paris

HAProxy Reload configuration in Crontab

DevOps

I had the strange behavior that I could not reload the HAProxy configuration inside a cron, here is why.

In a server I could not reload the configuration file with a simple service haproxy reload. I needed to use certbot with HaProxy and a simple reload of configuration for certificates to be taken by the configuration. Every time I do it by hand it worked, but not with the crontable.

Here is the lesson I learn: Always use the full path in cron!

# Does not work
5 1 * * 1-5 service haproxy reload

# work
5 1 * * 1-5 /usr/sbin/service haproxy reload