Free Software-based calendaring with pcal

Making Linux GPL'd was definitely the best thing I ever did. 

Linus Torvalds

Free Software-based calendaring with pcal

[Originally posted at as "Free Software-based calendaring -- manage your life and your band's!"]


Still using pcal and it still rocks!  Even with smartphones, paper calendaring and data longevity win.  I'll soon be implementing a wall calendar for LATI using pcal.

Original post

A number of friends have asked me recently (hi Rachel and Jason!) what I used to manage my and On Ensemble's calendars.  The following post explains my calendaring system based on Free Software, using easily-portable text files.

The old way

I used a Palm Pilot for years and loved having my calendar along with me at all times.  But the Palm was difficult to interface with gnu/linux (at that time) and all my calendar and schedule data was in Palm's proprietary format.  My Palm was eventually stolen and it felt like a good time to switch to a more flexible system.  I tried a software-based solution (Evolution at that time) but worried about the longevity of my information.  Would I be able to transfer my calendar to the next software I want to use?  So I used a simple text file for a while, basically a long list of dates and events, but I missed the graphical display of a calendar.

The new way: pcal

I then discovered pcal, a command-line program to generate pdf, html, and postscript calendars from a text file.  It's dreamy!  Now I simply print out as many months of my calendar as I want and carry that around with me (usually 6 pages, double-sided for this month plus 11).  No batteries, and it's not a big deal if I misplace it.  I make notes directly on the calendar when I'm away from my computer and enter the information later.  I can access the calendar text file easily through ssh from any computer connected to the internet.  I can process the file with standard unix tools to do fun things.  Backups are easy and efficient.

pcal is maintained by one of the most helpful, friendly people I've run into: Bill Marr.  He has been extremely helpful and even created a scripts section of the pcal website to host the scripts I've created.

Daily Reminders

One of my favorite features of this calendaring system is a script that runs daily to look through my calendar and send me an email with that day's events.  It also includes tomorrow's events, and events one week in advance (and can be set up to do any combination of days one wants).  The emails look something like this:

TODAY'S EVENTS (Sep 30, 2007):

30/09/07                Hiro's parents leave?

TOMORROW'S EVENTS (Oct 01, 2007):

01/10/07        11:30-18        Work at JACCC ticket office

ONE WEEK FROM TODAY (Oct 07, 2007):

07/10/07                Jason lesson at practice space
07/10/07                Maz to go to Japan?
07/10/07                Shoj out with Hiroshima

If you've got pcal installed (on debian, I simply ran "apt-get install pcal"), the system assumes your .calendar file lives in your home directory.  Read the pcal documentation to get started and to add a few event entries.

To try out my daily reminders script, you'll need to download the script, put it where it needs to be, and give it the proper permissions.

1) Download the script by clicking my_daily_reminder_script.

2) Put the script in the /usr/local/bin directory

3) The permissions must allow the program to be executed.  As root, run "chmod 750 /usr/local/bin/" and chown <your username> /usr/local/bin/"

4) Read through the script and adjust the configurations as necessary (changing the email address to be your own, etc)

5) Test the script by running it: /usr/local/bin/

You should receive an email.  Make sure there are entries for today, tomorrow, and one week from today in your .calendar file so the three searches performed in the script will all return something.  If the script is working properly, you should receive an email containing the events.

Once the script appears to be working properly, put an entry in crontab (crontab -e) to run the script at a set time every day.  Mine runs the script at 4am and looks like this:

xuxa@chappa:/tmp$ crontab -l
00 4 * * * /usr/local/bin/

Group calendar

The next great feature of the system is that I use it to generate On Ensemble calendars in html format and upload them to where the group can see them.  The system also generates an email to all the members of the group and our agent that lists the dates on which events have changed and has a PDF version of the calendar attached.  Cool, no?

I incorporated the email announcement and calendar update functions into a script that also automates the things I do often with pcal, namely viewing, printing, and emailing my calendar to my partner.

Group-relevant entries in the .calendar file include a searchable tag ("ON", for On Ensemble, in our case).  The script first pulls out the tagged entries (with grep) and then uses pcal to generate the group's calendar.

I added a few additional features to the script (options for displaying, printing, emailing the calendar to my partner, etc).  The full script is called cgen for (calendar generate).

Happy hacking!  Please let me know in comments below if you have any questions or suggestions!