I’ve been using Remind for years now ever since de-Googling my life and by using I mean not at all effectively: I basically print out a calendar when I remember and go “Oh, I missed so-and-so’s birthday again”.

I have this shell function:

	function remcal {
		if [[ -z "$@" ]]; then
			remind -clcm ~/.reminders $(date '+%b %Y')
		else
			remind -clcm ~/.reminders "$@"
		fi
	}

So I can do things like remcal sep 2018 if I fancy looking ahead. This is all very pretty looking for a terminal based calendar, but utterly useless when it comes to reminding me about things - it’s not Remind’s fault, it’s just how I’ve decided to use it to date.

I could have Remind email me a notification or, I guess, even flash something in a Tmux status bar (that’s a neat idea for another day actually), but the only thing I’m likely to check is Teuxdeux so I thought I’d take further advantage of Haskerdeux and have Remind trigger stuff through to Teudeux with enough notice for me to do something about it: E.g. “So-and-so’s birthday in 2 weeks!”; If it’s not on my todo list it won’t happen, if it is on there is a slim chance it will happen.

This should have been really straightforward, but actually was a bit fiddly. Since Remind doesn’t have any useful form of tag support I decided to use a specific remind file for things I want to pipe to Teuxdeux; This is no big deal as I already have separate files for work, home and school calendars, etc.

My first line of thought was using crontab and Remind’s -k mode, e.g. a script like this called from cron:

reminddate=`date -d "+14 days" +%Y-%m-%d`
remind '-k haskerdeux today new "%s in 14 days time!"' .reminders-teuxdeux $reminddate

I.e. Call Remind with a 14 day lookahead. This script worked wonderfully from a normal terminal, but unfortunately I had dreaded crontab issues which I could not resolve. It must be something to do with the fact that it’s a Haskell program making system calls to curl, but no amount of path setting or environment variables in crontab would make it work.

Just to make sure I tried a couple of tweaked approaches.

First of all using Remind a bit better and using WARN so it would trigger 14 days before:

FSET _wfun(x) 14
REM Aug 29 AT 00:01 WARN _wfun MSG "This a reminder on %d%s"

And avoiding the need for the script to lookahead 14 days.

As a tweaked attempt I also tried running Haskerdeux directly from Remind:

REM Aug 29 AT 00:01 WARN _wfun RUN haskerdeux today new "This is a reminder on %d%s"

I.e. so crontab was just calling a script that just had a plain remind .reminders-teuxdeux in it.

But cron still threw a wobbly over these.

So I gave up on cron and started looking into Remind’s daemon mode. The big problem with the daemon mode is that it doesn’t act on any advanced triggers, i.e. it completely ignores WARN and SCHED. To work around this I’m doing the following in my Remind file:

REM Aug 30 -14 AT 00:01 RUN haskerdeux today new "This is a reminder on [ord(day(trig-date()+14))]"

I.e. offset the date by -14 days so the real date is brought forward and then take advantage of Remind’s many functions and re-write the date in the string to be 14 days ahead. A bit hacky, but it works a treat.

Now I just need to update Haskerdeux so it logs back on automatically when the cookies expire.

yes, yes, I could just use yearly repeating todos direct in Teuxdeux manually offset to give me enough notice, BUT for the cases where the date isn’t the same every year (e.g. Mothering Sunday) - Remind cracks that.


[EDIT: 2018-02-26] It worked!