I’ve written a number of posts about cron jobs becuase cron can be so useful in managing a site, plus cPanel makes it easy to set up and edit one.
Get your job to include useful info in the email that it sends you. You can notifiy yourself of success or failure, or post details about the nature or results of the cron job.
Let’s say your cron job automatically IMs your boss with a random question every hour (like Wally did in this Dilbert comic strip):
Here’s the code snippet (PHP) that is part of your script run by cron. It lets you know whether your job worked or not, and what you IM-ed:
// check for success or failure
if (empty($buffer)) {
echo “failure”;
else {
echo “success — the IM message was: ” . $im;
}
My example uses PHP, but the concept is the same if you use PERL, bash shell or whatever you prefer.
When you are working on localhost, the output will display on screen. You can check and debug there. When you are on your server, the output will be part of the email the server sends you. That way your will have an email history of what you automatically IM-ed your boss and what time it went out.




5 star article brilliant. I am new to blogging and you used a langauge I can understand