Hi,

        So I've had this same issue.  I ended up writing a Perl script to deal 
with the different ways I wanted the different kinds of reminders to show up.  
Basically I wanted birthdays to be presented differently than to-do list stuff, 
etc.  Anyway I know if this is not the most elegant solution, but here it's 
attached in case you wanted to spend the time to hack it up to do what you want.

        I placed this in my personal bin dir so it would get run instead of the system remind (the 
sys "rem" is a script that calls whatever remind is first in your path) and the remind 
files are in a directory called ".remind" in my home dir.  See the script for details.

        Hope this helps,

                -S


Message: 1
Date: Mon, 21 May 2007 11:23:10 -0400
From: Paul Hoffman <[EMAIL PROTECTED]>
Subject: Re: [Remind-Fans] re-read INCLUDE files in daemon mode
To: Users of the <[EMAIL PROTECTED]>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=utf8

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 <[EMAIL PROTECTED]>



------------------------------

_______________________________________________
Remind-fans mailing list
[email protected]
http://lists.whatexit.org/mailman/listinfo/remind-fans


End of Remind-fans Digest, Vol 39, Issue 8
******************************************
#!/usr/bin/perl -w

use strict;

# This program runs remind for me, so I can just type "remind" and it will do
# the right thing.

my $SYS_REM="/usr/local/bin/remind";
#my $SYS_REM="~/bin/src/remind-03.00.24/src/remind";
my $dir="~/.remind";

my $bdayfile="$dir/" . "birthdays";
my $normfiles="$dir/" . join(" $dir/",
        ("shorttime", "longtime", "periodic", "holidays", "tv/*.sch") );
my $todo=`cat "$dir/to-do.txt"`;



# Now let's start the code.

# If this was called from rem, then we don't add the added .reminders.
my $arg;
my $rem_args = "-h -"; # hush (no output if no reminders), and stdin.
foreach $arg (0 .. $#ARGV) {
        if( "$ARGV[$arg]" ne "$ENV{'HOME'}" . "/.reminders" ) {
                #Check if it's is an option or not.
                if( substr($ARGV[$arg], 0, 1) eq "-" ) {
                        $rem_args = $ARGV[$arg] . " " . $rem_args;
                } else {
                        $rem_args = $rem_args . " " . $ARGV[$arg];
                }
        }
}


# The Birthdays.
my $bdayrem = "";
open(FI, "$bdayfile") or $bdayrem = "rem: Could not open $dir/$bdayfile";
while(<FI>) {
        if(/^\#/) { next;
        } 
elsif(/^([0-3]?[0-9]\s+[a-zA-Z]{3})\s+(.+)\s+born\s+([0-9]{4})\s+(.*)/) {
                #print "::$1::$2::$3::$4::\n";
                $bdayrem = $bdayrem
                        . "\nREM $1 +10 MSG Birthday soon:  _$2_  is "
                        . "[year(trigdate())-$3] %b.  $4";
        } elsif(/^([0-3]?[0-9] [a-zA-Z]{3})\b(.+)\bis\b(.+)$/) {
                $bdayrem = $bdayrem
                                                . "\nREM $1 +10 MSG Birthday 
soon:  _$2_  is $3 %b";
        } else {
                if(not /^[\s]*$/) {
                        $bdayrem = $bdayrem . "\nMisformed birthday line: $_";
                }
        }
}
close(FI);

# Run remind for birthday's and norm files.
my $rem_out = `echo "$bdayrem" | cat - $normfiles | "$SYS_REM" $rem_args`;

# Now add the to do list.
chomp $rem_out;
if(not $todo =~ /^[\s]*$/) {
        #$todo =~ s/^/    /gm;
        chomp $todo;
        $rem_out = $rem_out
                . 
"\n*****************************************************************\n"
                . $todo . "\n";
}


# If there is anything to remind, do so.
if($rem_out) { # If remind actually had some output.
        print 
"*****************************************************************\n"
                . 
"*****************************************************************\n"
                . "\n"
                . $rem_out
                . 
"*****************************************************************\n"
                . 
"*****************************************************************\n"
                ;
}
# Allowable lines:
# Cmments anything with '#' as the first char.
# {day} {month} {name} born in {year} [comments]
#    Ex:  27 Dec Hazel Anne Carrol born 1974
#    Ex:  27 Dec Hazel Anne Carrol born 1974 Dont talk to this one.
# {day} {month} {name} is {description of age}
#    Ex:  23 Jul Doyle is ??


# 27 Dec Hazel Anne Carrol born 1974

# 3 Feb Emily w/ Mason is 25 or 26 in 2005.

17 Mar Pleman born 1980 In 2012 he's leaving LA; maybe remind him? (See email 
called 'primes'.)

27 Mar J is ??

13 may cw is 30 in 2006

23 Jul Urpn is 34 in 2005

23 Jul Doyle is ??

21 sep Kar is older than me by 6 days shy of a month.

04 Dec Mason is ??

09 Apr V born 1948

10 Apr John is ??

28 Apr Jer is ??
_______________________________________________
Remind-fans mailing list
[email protected]
http://lists.whatexit.org/mailman/listinfo/remind-fans

Reply via email to