Temporarily stopping execution in scripts

One of our junior sys admins told me he was trying to figure out how to modify his monitoring script during maintenance windows (the monitoring script is called automatically by the monitoring agent on the box.) I told him to use a "stop file."

At or near the top of your script (a simple bash script,) put a block like this:

if test -f /tmp/do_not_run

echo "Ok"
exit 0


Then, during maintenance windows, create the /tmp/do_not_run file and the script will simply exit without attempting to perform any actions against the system. When the maintenance window is over, remove the file and everything goes back to normal.