Friday, June 29, 2012
Progress of sorts
I had two goals in mind when I started thinking about this project. The first was to process only the newest haiku into searchable text and to append it to the existing archive. Previously I had been processing a folder with all the haiku I had written to date. That's fine in January, but by 29 June I've already written over 500! I reasoned that it should be fairly trivial to implement this and that it would far more efficient than re-processing older haiku day after day. The second was to eliminate the manual step currently required to initiate the processing of the new haiku - I wanted the act of sending an email to a dedicated folder to kick this off instead. Right now I have to execute a shell script to do this. Acting upon a change to a file is something Puppet is very good at; hence the name of this blog. I'm happy to report that I've mostly accomplished the first goal. Thanks to procmail, it was easy to create a rule to create a new mailbox with a solitary purpose: to hold new, unprocessed email. Once processed, the mailbox can be discarded. I was already using procmail to create a folder for all of the haiku I'd written since the beginning of the year. The messages in the folder are converted to individual HTML files by Hypermail. It was only a matter of adding 3 lines to my original shell script to process the new folder as well. I then modified my newer script to perform post-processing on only the newly-created HTML files and to append it to the existing archive. Therein lies the rub: I'm still kicking off a script to update the archive. It's much quicker now that it's only processing the haiku written since its last execution, but it would be so nice to have that already-completed act of sending an email initiate this process. And I refuse to believe that it can't be done.