[comp.sys.sun] Calendar

rzh@icf.llnl.gov (R. Hanscom) (06/29/90)

Can anyone help me with a "calendar" question, or perhaps point me at the
right FM??  One user on my network is getting 3 mail messages from
calendar...one server is sending one, and the other server is sending 2,
about 7 or 8 seconds apart.  What determines if a machine sends out
calendar mail (other than the fact that the user has a file called
calendar with an entry for that day's date)??  How does calendar identify
users -- from passwd, or aliases, or what??  Will a user get mail from
every machine on the net that mounts his/her home directory, and runs
calendar??

Thanks.

eggert@uunet.uu.net (Paul Eggert) (07/04/90)

R. Hanscom asks:

	What determines if a machine sends out calendar mail?

It depends on which version of SunOS you're running.  Under SunOS 4.1, the
default is to not send out calendar mail.  To turn it on for just
yourself, run `crontab -e' and add a crontab entry like

	1 3 * * * calendar

It's best to do this while logged into the host that owns your calendar
file.

Older versions of SunOS attempt to send calendar mail for everybody using
heuristics that vary with the OS release.  Some releases look in the YP
passwd map; others look in just /etc/passwd.  Some check that the user's
calendar file is not NFS-mounted; others don't.  This is hard to do
efficiently and safely because of home directories mounted over the net,
so Sun eventually gave up.  If your users can't run `crontab -e' because
they're stuck on older SunOS releases, you can tailor the root crontab
entries that invoke /usr/bin/calendar to suit your local conventions.

graham@relay.eu.net (Graham Underwood) (07/04/90)

In article <9574@brazos.Rice.edu> you write:
>
>Can anyone help me with a "calendar" question, or perhaps point me at the
>right FM??  One user on my network is getting 3 mail messages from
>calendar...one server is sending one, and the other server is sending 2,
>about 7 or 8 seconds apart.  What determines if a machine sends out
>calendar mail 

Calendar is generally started by cron.  Either it consults ~/calendar or,
if started with a - switch, the calendar file for every user on the
system.

By default Suns come with a 'calendar -' entry in the root crontab, i.e
calendar is run for all users daily.  Maybe both servers still have this
entry - which would explain 2 messages.  To account for the third, do you
have a private crontab file with calendar in it ?

FM entries are 
	man calendar 
	man crontab
	man 5 crontab

Graham.

moj@mirfak.UTU.FI (Matti Jokinen) (07/06/90)

>One user on my network is getting 3 mail messages from
>calendar...one server is sending one, and the other server is sending 2,
>about 7 or 8 seconds apart.

At least in SunOS 4.0.3 there is a bug in /usr/bin/calendar: the messages
are sent twice if the userid is both in /etc/passwd and in the YP map.
Fortunately /usr/bin/calendar is a script and can be fixed easily:

27c27
>       $caldata |cat /etc/passwd - | grep -v '^[+-]' |\
---
<       $caldata |cat /etc/passwd - | grep -v '^[+-]' | sort -u |\

bill@uhura.cc.rochester.edu (Bill Vaughn) (07/10/90)

In article <9691@brazos.Rice.edu> moj@mirfak.UTU.FI (Matti Jokinen) writes:
>
>At least in SunOS 4.0.3 there is a bug in /usr/bin/calendar: the messages
>are sent twice if the userid is both in /etc/passwd and in the YP map.
>Fortunately /usr/bin/calendar is a script and can be fixed easily:
>
>27c27
>>       $caldata |cat /etc/passwd - | grep -v '^[+-]' |\
>---
><       $caldata |cat /etc/passwd - | grep -v '^[+-]' | sort -u |\

While looking at /usr/bin/calendar in order to checkout the above fix I
noticed a curious line:

		if (/usr/lib/calendar $y/calendar)

Now /usr/lib/calendar is supposed to create a 'sed' script used to find
specific dates in one's calendar file.  I'm not sure that it's exit status
is well defined and I'm not sure what it will do with the argument.
Shouldn't the line be:

		if test -f $y/calendar			?

Is /usr/lib/calendar doing something that's not documented here such as
testing the existence of it's argument?  Just curious.

Bill Vaughn
bill@cvs.rochester.edu

jms@tardis.tymnet.com (Joe Smith) (07/11/90)

In article <9574@brazos.Rice.edu> rzh@icf.llnl.gov (R. Hanscom) writes:

>about 7 or 8 seconds apart.  What determines if a machine sends out
>calendar mail (other than the fact that the user has a file called
>calendar with an entry for that day's date)??  How does calendar identify
>users -- from passwd, or aliases, or what??  Will a user get mail from
>every machine on the net that mounts his/her home directory, and runs
>calendar??

There are two calendar programs.  /usr/bin/calendar is the top level
script, you can type it out to see how it works.  If given an argument
(such as a single hyphen), /usr/bin/calendar does everyone's calendar
file.

/usr/lib/calendar is an executable binary.  If invoked with no arguments,
it creates a file for egrep to use to match lines with today's date.  If
invoked with the name of a file, it returns true of the file is NOT on an
NFS mounted system.  The idea is so that if the home directories are cross
mounted on several file servers, mail to a specific user will only come
from the local file server.

The version of /usr/bin/calendar for SunOS-4.1 optimizes the search for
local home directories by adding a grep command to the ypcat command:
    caldata="/bin/ypcat passwd.byname | grep /home/`hostname`"
That plus the "sort -u -" eliminated duplicate mailing on our system.

Joe Smith (408)922-6220 | SMTP: jms@tardis.tymnet.com or jms@gemini.tymnet.com
BT Tymnet Tech Services | UUCP: ...!{ames,pyramid}!oliveb!tymix!tardis!jms
PO Box 49019, MS-C41    | BIX: smithjoe | 12 PDP-10s still running! "POPJ P,"
San Jose, CA 95161-9019 | humorous dislaimer: "My Amiga speaks for me."