If you run a cron job every day, you're likely fed up of all the email you get from it.
Here's how I run a cronjob and only have it output stuff once a month, that's a lot easier to check every now and again. You can change the day of the month that you get the email over various cron jobs so you only have something to check every now and again (not a bunch of stuff on the first of the month). No need for anything special in your crontab.
#!/bin/sh
# On the first of the month run with debug output so we can check it.
if [ $(date +%d) = "1" ]; then
set -e -x
else
exec 2>&1 >/dev/null
fi
Here's how I run a cronjob and only have it output stuff once a month, that's a lot easier to check every now and again. You can change the day of the month that you get the email over various cron jobs so you only have something to check every now and again (not a bunch of stuff on the first of the month). No need for anything special in your crontab.
#!/bin/sh
# On the first of the month run with debug output so we can check it.
if [ $(date +%d) = "1" ]; then
set -e -x
else
exec 2>&1 >/dev/null
fi
# Do what you normally would do here....
Comments
Posted Tuesday 25 May 2010 Share