Skip to main content

Chef: "notifies :restart" - stop watchdog prior to restarting service [Resolved]

We are using the community Chef apache2 cookbook with great success; my question revolves around using the "notifies" notification mechanism to tell Apache 2 of configuration changes.

We run a custom watchdog utility to restart the whole app, including Apache, if it become unresponsive. This watchdog utility queries a particular status URL to determine availability. The problem is, if the timing is bad and the watchdog does a health check just as Chef is restarting Apache, then the whole app stack is bounced.

Is there a way I can make the "notifies" mechanism shutdown the watchdog when it restarts Apache at the end of the run? Then start the watchdog up again once Apache has been restarted.



Question Credit: Fred Clausen
Question Reference
Asked June 14, 2019
Tags: chef
Posted Under: Network
2 Answers

To answer my own question - what I did was make the watchdog application "Chef aware". That is, when Chef is running it must not restart anything even if it notices something is down. That prevents spurious restarts.

credit: Fred Clausen
Answered June 14, 2019

Another way would be to make watchdog take an interval of time before being sure that service is indeed down. So it should test the URL 10 times in span of 3 mins to say for sure the service is indeed down. This 10 fail results should be continuous.

credit: Subodh Sharma
Answered June 14, 2019
Your Answer