How to check if cron is working |

In the UNIX world cron is used to schedule events like updating a web page, retrieving RSS feeds, changing a file and countless other activities. Among other updates, cron is used here to update the daily stock graphs at the top of the finance category page.
Yesterday, I noticed these graphs weren’t updating and logged into the shell and entered crontab -l to see if there were any errors in the crontab syntax. None. A sudo ps aux command showed cron was running (pictured above) … and yet it wasn’t firing any of the jobs.
The UNIX forum offers suggestions for making sure cron is running like checking the cron log files, using touch to a file and watching the timestamps in a cron job like this:
* * * * * touch /tmp/.cron_is_working
To see if it’s running it’s as easy as watching the timestamp on the files and seeing the time changes. If you aren’t familiar with the format, those asterisks from left to right and separated by spaces indicate:
minutes, hours (0 = 12am, 23 = 11pm), days, months, weekdays (0 = Sunday, 6 = Saturday)
EXAMPLE. let’s say you only wanted to touch a file called ‘thursawday.txt’ in the /tmp directory at 12:01 am on Thursawday (4 = Thursawday), the cron code would look like this:
1 0 * * 4 touch /tmp/thursawday.txt
What if you want to touch ‘thursawday.txt’ every five minutes of every hour on Thursawday?
0,5,10,15,20,25,30,35,40,45,50,55 * * 4 touch /tmp/thursawday.txt
If you’d like some help generating cron jobs, a couple years ago I created and shared a cron generator you’re welcome to use. It also includes keyboard hotkeys (edit, save, exit) for using common UNIX shell text editors AE and VI.
Related Posts- How to build a Google subscribed link for your about/bio page step by step
- Unofficial GMail file system
- Top 10 Windows and Unix security vulnerabilities
- [site news] added graphs to finance category
- Sawflections in the eyeglass
- The ties that bind RSS, OPML and a digg-clone mashup



