Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Oct 2003 03:42:45 -0500
From:      "Charles Howse" <chowse@charter.net>
To:        "'Greg 'groggy' Lehey'" <grog@FreeBSD.org>
Cc:        questions@FreeBSD.org
Subject:   RE: Hacking calendar(1)
Message-ID:  <005001c397af$4cf4d2d0$04fea8c0@moe>
In-Reply-To: <20031021025223.GH42029@wantadilla.lemis.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> On Sunday, 19 October 2003 at 16:13:09 -0500, Charles Howse wrote:
> > Hi,
> > When I get my daily calendar email, there is no explanation of which
> > entries come from which calendars.
> > Other than hacking the source code, is there a way to get=20
> some headers
> > like this?
> >
> > Music History:
> > Oct 20 	Three members of Lynyrd Skynyrd die in a plane=20
> crash, 1977
> >
> > World History:
> > Blah blah blah
> >
> > Computer History:
> > Blah blah blah
>=20
> The daily calendar information comes from the script
> /etc/periodic/daily/300.calendar.  It should be relatively
> straightforward to change that script.

My solution...
I found an old post by Greg Lehey that I have modified.
I run it from cron at midnight every day.
It's working great so far!
See it in action as a cgi script, w/o the mail line:
http://howse.homeunix.net/calendar.shtml
Comments, suggestions?

---------------------
#!/usr/local/bin/bash
#
# Go through the calendars and find out what happened today.

dir=3D/usr/share/calendar
file=3D/root/today_cal

if [ -a $file ] ; then
    rm $file
fi

if [ -n "`/usr/bin/calendar -f $dir/calendar.birthday`" ] ; then
    echo "Birthdays:" >> $file
    /usr/bin/calendar -f $dir/calendar.birthday >> $file
    echo >> $file
fi

if [ -n "`/usr/bin/calendar -f $dir/calendar.christian`" ] ; then
    echo "Christian:" >> $file
    /usr/bin/calendar -f $dir/calendar.christian >> $file
    echo >> $file
fi

if [ -n "`/usr/bin/calendar -f $dir/calendar.computer`" ] ;then
    echo "Computer:" >> $file
    /usr/bin/calendar -f $dir/calendar.computer >> $file
    echo >> $file
fi

if [ -n "`/usr/bin/calendar -f $dir/calendar.music`" ] ; then
    echo "Music:" >> $file
    /usr/bin/calendar -f $dir/calendar.music >> $file
    echo >> $file
fi

if [ -n "`/usr/bin/calendar -f $dir/calendar.usholiday`" ] ; then
    echo "U.S. Holidays:" >> $file
    /usr/bin/calendar -f $dir/calendar.usholiday >> $file
fi

cat $file | mail -s "Today's Calendar" charles=20




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?005001c397af$4cf4d2d0$04fea8c0>