[Remind-Fans] re-read INCLUDE files in daemon mode

Paul Hoffman nkuitse at nkuitse.com
Mon May 21 11:23:10 EDT 2007


On Mon, May 21, 2007 at 02:58:01PM +0100, Stuart Houghton wrote:

> Hi,  I like to organise my .reminders file so that it just contains
> INCLUDE statements for things like 'birthdays.txt'. 'todo-list.txt'
> etc.
> 
> When I run in daemon or server mode, there doesn't seem to be a way of
> getting remind to expand these INCLUDEs when it re-reads the
> .reminders file.
> 
> Is this possible, or do I just have to run an individual daemon for
> each of the includes?

Well, I suppose you could just cat all your INCLUDEd files to .reminders
when any of them changes, run remind in server mode, and use a FIFO to
control it.  Off the top of my head:

$ cd
$ mkdir -p .remind/include
$ vim .remind/include/birthdays.txt
$ vim .remind/include/todo-list.txt
(etc. -- move everything out of .reminders!)
$ mkfifo .remind/server-control
$ cat <<EOS > ./my-remind.sh
> #!/bin/bash
> # Start remind in server mode
> remind -z0 .reminders < .remind/server-control &
> # Clear previous list of all reminders
> : > .remind/prev
> # Loop forever
> while true; do
>     # N.B.: This next line requires bash
>     if ! cmp .remind/prev <(cat .remind/include/*.txt); then
>         # Something has changed -- "rewrite" .reminders
>         # and remember all reminders
>         cat .remind/include/*.txt | tee .remind/prev > .reminders
>         # Tell remind to re-read all reminders
>         echo REREAD > .remind/server-control
>     fi
>     sleep 15  # or however long you wish
> done
> EOS
$ chmod a+x ./my-remind.sh
$ ./my-remind.sh &

There are sure to be bugs there, of course, and I doubt it's the best
approach, but FWIW...

Paul.

-- 
Paul Hoffman <nkuitse at nkuitse.com>




More information about the Remind-fans mailing list