pester...



ok, so for anyone on this list submitting patches to gnome i offer
a quasi-useful utility:

    pester

copy the file below into $HOME/bin/pester, make a $HOME/bin/lib/pester
and add the following to your crontab (hey, it's a first pass, how easy
can i make it?):

   0          7 * * *   $HOME/bin/pester -m d
   0          7 * * 1   $HOME/bin/pester -m w
   0          7 1 * *   $HOME/bin/pester -m m

modify it to suit.  this pesters at 7am for all pesters, on monday for
weekly pesters and on the first of the month for monthly ones.

if you want to know how to use it, just type pester.  and i've not only
decided to release the source i'll even offer it under the bsd license -
feel free to take it add a line or two and never let me see the source
in the resulting app.

--------------pester: snip---------------
#!/bin/sh

Q=$HOME/bin/lib/pester

usage() {
cat << USAGE
Usage: pester -h                          this message
       pester -d <pester>                 removes the given pester
       pester -q [-v]                     lists the queue [verbose]
       pester <d|w|m> <file> <subject> <addresses>
                                          queues the file to addresses - Daily,
                                          Weekly or Monthly - with the given
                                          subject.
       pester -m <d|w|m>                  sends file to addresses - Daily,
                                          Weekly or Monthly
USAGE
exit 1
}

list() {
    if [ -z `/bin/ls $Q/s$1* 2> /dev/null` ]; then
	if [ x"$4" = x-v ]; then
	    echo "No $3"
	fi
    else
	for f in `/bin/ls $Q/s$1*`; do
	    echo `basename $f|sed 's/^.//'`"  $2	 \""`cat $f`\"
	done
    fi
}

if [ x"$1" = x-h ]; then
    usage
elif [ x"$1" = x-q ]; then
    list d daily dailies $2
    list w weekly weeklies $2
    list m monthly monthlies $2
elif [ x"$1" = x-d ]; then
    rm $Q/[fas]$2
elif [ x"$1" = xd -o  x"$1" = xw -o  x"$1" = xm ]; then
    if [ ! -f $2 ]; then
	usage
    else
	file=`mktemp $Q/f$1.XXXXXX`
	fn=`basename $file|sed 's/^.//'`
	adds=$Q/a$fn
	subj=$Q/s$fn
	shift
	(
	    echo "To stop receiving this mail please request that the"
	    echo "sender run pester -d $fn .  Thanks."
	    echo
	    cat $1
	) > $file
	shift
	echo $1 > $subj
	shift
	for a; do
	    echo $a >> $adds
	done
    fi
elif [ x"$1" = x-m ]; then
    if [ -z `/bin/ls $Q/s$2* 2> /dev/null` ]; then
	echo "No mails to send"
    else
	for file in `/bin/ls $Q/f$2*`; do
	    fn=`basename $file|sed 's/^.//'`
	    adds=$Q/a$fn
	    subj=`cat $Q/s$fn`
	    mail -s "$subj" `cat $adds` < $file
	done
    fi
else
    usage
fi
--------------pester: snip---------------

kevin

-- 
kevin@suberic.net        perl -e 'print(map{chr($a+=$_)}(119,-18,7,0,-64,-12,
fork()'ed on 37058400    79,-1,-2,13,-89,83,-4,-2,-8,15,-11,4,-8,14,-105))'
meatspace place: work    http://suberic.net/~kevin/  yank? www.votenader.com
 >> want privacy? www.gnupg.org or www.pgp.com.  encrypted mail preferred <<

PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]