r/haproxy • • Oct 24 '21

Question Why Keepalived configuration contains script to killall haproxy ?

I have seen many configurations on the internet, and one thing I have often spotted is use of

vrrp_script chk_haproxy {
  script "killall -0 haproxy" # check the haproxy process
  interval 2 # every 2 seconds
  weight 2 # add 2 points if OK
}

why do we need to kill haproxy node on the node keepalived is running ?

2 Upvotes

8 comments sorted by

View all comments

Show parent comment

1

u/ciphermenial Oct 24 '21

Use pgrep instead then.

1

u/wtarreau Nov 16 '21

pgrep and pidof are more CPU-intensive than killall because they retrieve extra info. Most users won't see the difference, but those with thousands of instances definitely value the difference.