Cron Happiness

Today, I spent time digging through the crontab file on a server out on the internets.

Wondering why all of sudden the cron jobs I set up stopped working.

If anyone was wondering how to mail yourself if the *nix user your cron job is running under is not where you check you email, then hopefully this post can give you a hand.

Your cron job should look like this

30 12 * * * * “command to use” “full path to script”

That would execute the script everyday at 12:30 (Server Time … Dont forget those Time Zones all you remote admins!!!).
Once script execution is done, it will then email the results of the script to the user executing. Somewhere outthere in wonderland, if the script outputs anything to stdout, it would show up on the screen, and then email those results to the user.

If you want to also email the results to an address not on the machine, then do the following:

30 12 * * * * “command to use” “full path to script” | mail -s “Test”

This would use the *nix pipe command to push the results of script execution in an email to “” with “Test” as a subject.

Hope this helps!!!