Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a few cronjobs and one of them is run every minute. I had to take a website down for two hours and it caused an error on that one specific cronjob and I got almost 120 emails in those two hours until I was done upgrading the site.

Now lets say I was asleep and something happened. I don't want hundreds to thousands of emails because one cron job ran every minute and failed. Is there something I can do to limit how often it emails me while allowing it to run every minute?

PS: We dont have smtp servers, we use a 3rd party so I am glad nothing was marked as spam and disabled.

share|improve this question
add comment

1 Answer 1

You should employ some mechanisms to make sure the cronjobs/monitoring services are aware of the downtime/scheduled maintenance. Many programs lately such as Nagios, Zabbix offer such solution where in you can perform the scheduled maintenance and make Nagios aware of it through its interface , during which time, Nagios will not attempt to monitor the service.

Or more simpler, not to bloat onto use heavy Nagios for a single simple service monitoring service, make the cronjob script aware of some file locking mechanism, if the file lock exists, ignore any state for the service and do not spurr or yell on the output. It is upto Administrator to make sure that the file lock is removed after the scheduled maintenance is over, so that cronjob script can take back to start monitoring the system.

share|improve this answer
    
Sounds a bit complicated but do able. The cronjob in question is actually wordpress's cron.php file. I'll need to look at how i can execute it and capture the stdout and then using a file lock idea to 'silence' it until success. +1 and i'll accept if no other answers. –  acidzombie24 Jan 4 '12 at 9:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.