@Pooh yeah I know that, but sometime if it’s not a senior sysadmin that is
doing something it’s not always easy to do the curl call.
Put it into a script so that anyone can use it without understanding what’s in
it.
That’s why the idea of the maintenance file come in mind.
a) set up a cron job to look for the maintenance file and run the curl script
if it’s less than 100 seconds old
b) use inotify to detect the appearance of the maintenance file and run the
curl script
Another thing I’ve done is to create a new script in /etc/init.d called
“downtime”. It accepts the usual “start” and “stop” parameters, and for a
“start” it takes the machine out of downtime in Icinga, and for “stop” it puts
it into downtime.
The “Required-Start” dependency is “$all” and the “Required-Stop” dependency
is “$network”. That makes it the last thing to run on startup (so, all
services should have been started by the time downtime ends), and one of the
first to run on shutdown, and definitely before the network disappears (so, it
puts the machine into downtime early in the shutdown process).
That way, anything which does a clean shutdown / restart / reboot of the
server automatically puts it into downtime for the duration of the restart.