cronhelp – a syntax reminder for crontab

By | April 19, 2013

bash

One of the things an admin needs to know how to do quickly, is setup cronjobs. This is of course done using the crontab -e command. The syntax is hard for some to remember and instead of going to google and searching every time I needed to know the syntax again, years ago I created a small simple shell script called “cronhelp” that I stuck into /usr/local/bin/cronhelp

Then all I would have to do is type “cronhelp” on the command line and my simple help file would display.

#!/bin/bash
crontab ()
{
### cron - Displays a cron help file.
echo " "
echo "Crontab Example/Hints  "
echo "---------------------------------------------------------------"
echo "# +---------------- minute       (0 - 59)"
echo "# |  +------------- hour         (0 - 23)"
echo "# |  |  +---------- day of month (1 - 31)"
echo "# |  |  |  +------- month        (1 - 12)"
echo "# |  |  |  |  +---- day of week  (0 - 7)  (Sunday=0 or 7)"
echo "# |  |  |  |  |"
echo "# *  *  *  *  *  command"
echo "---------------------------------------------------------------"
echo " "
}
crontab
exit 0