betabug... Sascha Welter

home english | home deutsch | Site Map | Sascha | Kontakt | Pro | Weblog | Wiki

12 June 2008

Shell fun: get reminders with calendar(1)

This is so obvious

Quite similar to my last, lame shell fun post (which mentioned at(1)), is the calendar utility. This thing (when your system is set up properly) will send you reminder mails for calendar events you write into a special plain text file. It can also remind you of upcoming stuff when you log into your system. calendar is ages old, but still very useful when done right, especially for us coder types, who don't have 25 appointments each day...


The calendar file is usuall ~.calendar or (in order to be able to use sub-files at some point) ~/.calendar/calendar. Let's look at some typical entries there:

06/15    Write next shell fun post

Where the whitespace between the date and the text should consist of a Tab character. In theory different date formats should be recognized, but I hadn't much success with it, so I'm sticking to the weird US style of mm/dd. There's no year, if you don't want this event to stick around next year, go and clean up some time.

But wait! Some stuff that comes back each year makes very much sense, like... birthdays!

08/01    w... birthday
04/17    s.... birthday

There are some more fancy things you can do, like:

*/01    Rent!
/* simple: the first day of each month */

*/Mon-1    Monday - Notify about HelMUG Meeting next Sunday
/* which will be shown on the last Monday of each month */

*/Tue+1    OpenCoffee Athens First Tuesday Each Month

The last one will remind me to go to the OpenCoffee Athens event, to meet Stavros Messinis. If OpenCoffee is at all interesting (I don't know yet, haven't been there), I can leave this in and will be reminded each month.

To be reminded

To actually see the reminders, I have two ways:

  • My OpenBSD system is set up in /etc/daily to run calendar as root and mail reminders to all users. (We're assuming that mail is actually set up properly to deliver those mails.):

    echo "Running calendar in the background."
    calendar -a &
    
  • I've got this here in my .kshrc, which prints out the events for the next 10 days when I log in to an interactive terminal:

    if [ -o interactive ]; then
        echo coming up:
        /usr/bin/calendar -A 10
    fi
    

Also I can always run calendar -A 30 (or similar) to see the upcoming events for the next 30 days. As always, man calendar knows more!

Posted by betabug at 14:06 | Comments (0) | Trackbacks (0)
ch athens
Life in Athens (Greece) for a foreigner from the other side of the mountains. And with an interest in digital life and the feeling of change in a big city. Multilingual English - German - Greek.
Main blog page
Recent Entries
Best of
Some of the most sought after posts, judging from access logs and search engine queries.

Apple & Macintosh:
Security & Privacy:
Misc technical:
Athens for tourists and visitors:
Life in general:
<< Fussball und Regen | Main | Patch fun: have a look >>
Comments
There are no comments.
Trackbacks
You can trackback to: http://betabug.ch/blogs/ch-athens/844/tbping
There are no trackbacks.
Leave a comment