Sunday, July 1, 2012

Is that all there is?

Unable to figure out the proper procmail syntax to kick off the processing script only after the new email folders had been updated, I broke down and emailed the support team at Pair Networks, my ISP. Within a few hours of my email — on a Sunday morning, no less — I received a reply recommending that I use qmail instead, pointing me to their knowledge base. The syntax of qmail is far simpler than that of the more cryptic procmail, so the logic I needed was fairly straight-forward:
/usr/home/mena/mail/new_haiku
/usr/home/mena/mail/haiku_archive
|/var/qmail/bin/preline /usr/home/mena/bin/append_new.sh
The qmail naming convention is such that the name of the file can specify a unique email address for processing, which is exactly what I was looking for. Qmail rules for the email address joe@example.com would be in a file named .qmail-example:com-joe — not exactly intuitive, but easy enough after a few tests.

And then, just like that, it was working: I can now email a haiku to a specific email address and expect to see it added to my archive in the space of a minute or two. I didn't use puppet after all, but I combined my two shell scripts into one more efficient one, learned that sed on BSD (used by my ISP) isn't the same as sed everywhere else, and above all found a simple solution to a lingering problem.

So that's it — the anti-climactic conclusion of an ambitious project — although I have a feeling I haven't run out of things to puppetize at home. Has anyone seen the dog?