Packetizer
Packetizer Labs

Calendar

This is a calendar program for Linux and Unix systems that will display the contents the calendar file (and any files it includes) on the day that entries in the file should be displayed. There was once a program like this on old AT&T Unix systems years ago, but we could not find similar functionality for Linux when this was written. (It is available now, thus making this somewhat redundant. However, some of the features, like daily_calendar, make it an improvement over the older calendar tool.)

This program provided here is written in Perl, is completely open source, and free. If you find bugs or want to make improvements to it, you are quite welcome to do so.

To use the calendar program, put it somewhere in your path (e.g., $HOME/bin or /usr/local/bin). In your home directory, create a directory called "calendar" and a file inside that directory with the name "calendar". This is the first file that the calendar program will read. You may have any number of other calendar files included using the "include" directive. This directive may be used inside any calendar file, regardless of whether it is the primary calendar file or a child calendar file.

This is what a calendar file might look like:

#
# Calendar file
#
# Date  Message to deliver
#

# Include the other calendar files
include holidays
include birthdays
include bills

# Monthly events
*-04 What you need to do on the 4th

# Business events
06-01 Kentucky requires annual reports to be filed by June 30
2034-05-01 Some event scheduled in the future

Note that lines starting with a # are considered comments and are ignored. Blank lines (those without any text other than spaces and tabs) are also ignored. Calendar entries have a date following by a text string that should be shown to the user. Dates in a calendar entry may take several forms, including mm-dd-yy, yyyy-mm-dd, or mm-dd. The "-" character may be replaced with the "/" character. Not all date forms used around the world can be supported, since there is no way to differentiate between them. For example, a computer cannot tell the difference between "mm/dd/yyyy" and "dd/mm/yyyy". But, if you prefer dates in an alternative format, you are welcome to change the code! Perhaps a nice improvement would be to have a directive at the top of the calendar file to indicate the order of months and days; proposed code improvements are welcome.

In the place of any month, day, or year position in the date, one may use an "*", which will always match. So, if you want a calendar entry to always match the first of the month, use a date of "*-01".

To use this program, simply put an entry into cron like this:

30  3  *  *  *  $HOME/bin/calendar

You can see the calendar program here and its companion daily_calendar. Or, you may download a tar file with the calendar program and sample calendar files.