What does this cron entry do?

October 18th, 2006

Most businesses have some type of shared accounts where applications run. This could be websphere, apache, or an account running a custom application. Many times cron entries will be used to compress logs, check to make sure the application is running, or check filesystem usage statistics.

Some of these are just temporary and some of them become obsolete. This can be quite hard to manage if you are in a large environment. Thus, I add a header to each of these entries describing them for future employees. This allows them to quickly identify what an cron entry is supposed to do and whether it should even be running.

root@www:~ # crontab -l
# 3/6/2004, PERM, Update GopherBooks.com static data., BDN
* * * * * php /data/webroot/gopherbooks.com/updateStaticData.php
# 3/11/2006, PERM, Update Web Stats, BDN
0,30 * * * * /usr/lib/cgi-bin/awstats.pl -config=awstats -update >/dev/null
# 8/1/2006, PERM, Run Drupal Crontab, BDN
00 * * * * /usr/bin/wget -O - -q http://a-web-site/cron.php

The format I use is as follows. The header must start with a # to signify its a comment. The header then contains this information:

  • Date
  • Whether the entry is permanent (PERM) or temporary (TEMP)
  • A simple description
  • The initials of the person adding the entry

I prefer an empty line between each entry, but this is just preference.

Leave a Reply

If Wordpress eats your comment (shell output, loops, ex..) brock (at) gmail dot com.