Hacking calendar(1) - SOLVED
Charles Howse
chowse at charter.net
Mon Oct 20 14:09:01 PDT 2003
>> 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 some
headers
>> like this?
>>
>> Music History:
>> Oct 20 Three members of Lynyrd Skynyrd die in a plane crash, 1977
>>
>> World History:
>> Blah blah blah
>>
>> Computer History:
>> Blah blah blah
>
> Not really.
> The only cheap-and-easy hack I can think of is to modify (each line
> of) the calendar files themselves.
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!
Comments, suggestions?
---------------------
#!/usr/local/bin/bash
#
# Go through the calendars and find out what happened today.
dir=/usr/share/calendar
file=/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
---------------------
Output of today's email:
Birthdays:
Oct 21 Alfred Nobel born in Stockholm, 1833
Computer:
Oct 20 Zurich ALGOL report published, 1958
Music:
Oct 20 Three members of Lynyrd Skynyrd die in a plane crash, 1977
Thanks,
Charles
Got a computer with idle CPU time?
Join SETI at home and help make history!
http://setiathome.ssl.berkeley.edu/
More information about the freebsd-questions
mailing list