Create a simple reminder system with cron

Take advantage of cron's built-in capabilities to create a system that sends you e-mail reminders on particular dates.

Ever wished you had your own personal secretary, who would remind you of important events—your boss' birthday, your anniversary, the deadline for your tax returns? Well, wish no more—with a little creativity and some *NIX glue, it's easy to create an automated system which sends you reminders of important events by e-mail.

The core of this system is the cron daemon, a *NIX utility which is designed to automatically run commands at specified times. Cron works by reading a special job file, called a crontab, at intervals of one minute and executing all those jobs that match the current date and time. This built-in capability makes it extremely easy to create a system that sends out e-mail reminders on particular dates. Here's how:

1. Make sure you have cron, and that it's running

The most common version is Vixiecron, named after its creator, Paul Vixie. However, this being *NIX, numerous variants exist. You can check if you have the program with the which command, as below:

shell> which crond/usr/sbin/crond

Or, look for the binary crond with the find command:

shell> find / -name crond/usr/sbin/crond

You can check if the program is running with a quick scan of the process table:

shell> ps ax | grepcrond  277 ?        S      0:00 /usr/sbin/crond -l10

If the program shows up in the process table, you can go directly to the next step! If it doesn't, you'll need to manually start it, by executing the crond command, as below:

shell> /usr/sbin/crond

2. Decide your reminders

Once you've established that the program is installed and running, the next step is to define a reminder list. The best way to do this is with a pen and paper: write down the date for each reminder, the type of reminder interval (yearly, weekly, monthly, or custom), and a short message to describe the reminder. Here are some examples:

  • Mom's birthday - 15 May
  • Dad's birthday - 19 Sep
  • Anniversary in 1 week, gift reminder - 3 Jan
  • Anniversary - 10 Jan
  • Health insurance pymt  - 15 Jun

This step might seem somewhat silly at first glance, but once you sit down to create this list, you'll rapidly realize how useful it is. By writing down your reminder list you get a chance to clearly define your expectations of the reminder system and you also get to reevaluate your exact needs for each reminder. For example, if you have an insurance payment to make, you wouldn't want it to appear on the exact payment deadline; instead, you'd prefer it to show up a week earlier so that you have time to mail out a check. On the other hand, if you need a notification of a public holiday, you can have it sent out on the day itself (or a day earlier).

This proactive evaluation of your reminder needs will help you in the next step, when you convert your written list into a format that cron can understand.

3. Convert your reminders to a crontab

As noted previously, cron reads tasks from a crontab file, which is essentially a job queue. Therefore, you need to convert the list created in the previous step to a crontab. But before you can do that, you need to understand how cron represents tasks in a crontab.

Every entry in a crontab file represents an action to be performed, and consists of a series of six fields, separated by blank spaces. Table A shows you what each field represents:

Table A

Field #



The minute of the hour


The hour


The day of the month


The month


The day of the week (0 = Sunday)


The command line to execute

Here's an example of a crontab entry:

# on Jul 14 every year, at 06.05 PM5 18 14 07 * /usr/local/

Once you've understood the format, begin by creating a new crontab, using the command below:

$ crontab -e

You'll be presented with a blank crontab file. Now, proceed to translate the list from the previous step into crontab entries. Here's a sample, based on the example list created previously.

0 0 3 1 *   /bin/mail -s "REMINDER: Buy anniv gift" addr@example.com0 0 10 1 * /bin/mail -s "REMINDER: Anniversary" addr@example.com0 0 15 5 * /bin/mail -s "REMINDER: Mom's Birthday" addr@example.com0 0 15 6 * /bin/mail -s "REMINDER: Pay health insurance" addr@example.com0 0 19 9 * /bin/mail -s "REMINDER: Dad's Birthday"

Pay attention to the command line for each entry. Here, the mail command is used to generate a quick-and-dirty e-mail message with a subject line of REMINDER: followed by a descriptive label. Do remember to alter the example destination address in each line to reflect your actual e-mail address.

Once you've finished creating the crontab, save the file and exit the editor.

At this point, your reminder system is complete and ready to go! As soon the dates and times in your crontab become due, cron will execute the corresponding command line, causing an e-mail message to be automatically generated and sent to you.

Important: Reminders will only be generated when the cron daemon is active. So, if you turn off the daemon (or the computer), reminders that come due during the "blackout period" will not be generated. For this reason, it's best to implement the above reminder system on a network server/device which is always turned on.