I have never been especially good at remembering dates or appointments. My memory just doesn’t seem constructed to handle things like “on YYYY-MM-DD do X” (peculiarly enough, “on Friday next week, have X done” works much better).
I guess things relative to “now” works better for me (at least in the short term) than some abstract date some time into the future.
Luckily enough, I don’t seem to be the only one suffering from having an “appointment-impaired memory” so others have created calendar applications and what not.
These work great, the one I presently use, remind is awesome. But sometimes it isn’t “intrusive” enough.
There are some appointments/dates that are important enough that I would like for remind to hunt me down an alley and smack me over the head with the notification, as opposed to presenting it to me when I query it for today’s appointments.
So I put together a little shell script which push notifications (the ones I feel are the most important) to me via jabber.
The solution involves cron, remind, grep and a nifty little program called sendxmpp.
This script I have placed on my “laptop-made-server” which coincidentally also happens to be the central mercurial server, through which I synchronize the repositories on my desktop and netbook.
Which means that if I just take care to clone the specific repository containing my remind files to some place local on the server, I could have a cronjob pull and update that repository and it would thus always (as long as I have pushed changes made from the desktop/netbook) have the most up to date files available.
If setting up a repository server seems to big of a hassle, one could of course (at least with remind) have a master
~/.reminders file, which then invokes an INCLUDE expression.
This makes remind look in the specified directory for other files, and in that directory have one file for each computer (along the lines of .rem) and have each individual machine scp (and overwrite) their individual file every now and then.
In any case, once the server have fresh and updated sources of data, all it need do is execute the idn.sh script once every day (preferably early, this will work pretty well as the jabber-server I use caches all messages sent to me while I was offline, so once I log in again, I’ll get the notifications then).
As sendxmpp takes the message from STDIN, recipient-addresses as parameters, and parses a configuration file to divine what account should be used to send the message (I set up a “bot” account to send from, and then just authorized that bot in my primary jabber-account), I see no reason why someone couldn’t modify the script to instead (or in addition) use something like msmtp to send out and email instead.
The script itself, in its current form, is rather straightforward, although I’m sure there are still room for optimizations.
#!/bin/sh TAGS="#Birthday #ATTENTION" for t in `echo "$TAGS"`; do rem | grep -i "$t" | while read line; do echo "$line" | sendxmpp email@example.com done done exit 0
Relevant parts of my crontab:
0 7 * * * cd /home/patrik/remind-repo; /usr/bin/hg pull -u 2>&1 5 7 * * * cd /home/patrik/idn-repo; /usr/bin/hg pull -u 2>&1 10 7 * * * /bin/bash /home/patrik/bin/idn.sh 2>&1
/home/patrik I have created symlinks
/home/patrik/.remind -> /home/patrik/remind-repo/.remind and
/home/patrik/.reminders -> /home/patrik/remind-repo/.reminders
/home/patrik/bin/ I have a symlink (idn.sh) to
/home/patrik/idn-repo/idn.sh. So in case I change the script, like add a tag to look for or something (ok, that should be moved out to a configuration file, that will be part of the next version) that will be picked up as well, before the notifications goes out.
And that’s about it. Risk of forgetting something important: mitigated.