[net.unix-wizards] Cron, /etc/motd & cronlog

seth@megad.UUCP (Seth H Zirin) (06/17/85)

The message of the day ("/etc/motd") is printed in the cronlog file every
time an "su - user -c command" is executed by cron.  Does anyone know how
to supress the "printing" of /etc/motd when using the "-" option to su?
It would make the cronlog smaller and more easily read.  We use Uniplus+
System V.
					tanks,
-- 
-------------------------------------------------------------------------------
Name:	Seth H Zirin
UUCP:	{decvax, ihnp4}!philabs!sbcs!megad!seth

Keeper of the News for megad

jfs@ih1ap.UUCP (Jesse Fred Shumway) (06/21/85)

> The message of the day ("/etc/motd") is printed in the cronlog file every
> time an "su - user -c command" is executed by cron.  Does anyone know how
> to supress the "printing" of /etc/motd when using the "-" option to su?
> It would make the cronlog smaller and more easily read.  We use Uniplus+
> System V.

I assume that if "user" has mail that fact is also noted in the
cronlog. 

The problem probably resides in /etc/profile; which should check $0
to see if it was invoked as "-su" or "-sh|-rsh". Only in the latter
case should it cat /etc/motd and announce that mail is present.
Check your original distribution and if it doesn't do this you
might call the Uniplus+ people and ask why they so gracelessly
munged /etc/profile. Or, maybe /bin/su isn't changing $0 to "-su".

Jesse Fred Shumway 	AT&T-NS 	(312) 510-7880 

alan@drivax.UUCP (Alan Fargusson) (06/23/85)

> The message of the day ("/etc/motd") is printed in the cronlog file every
> time an "su - user -c command" is executed by cron.  Does anyone know how
> to supress the "printing" of /etc/motd when using the "-" option to su?
> It would make the cronlog smaller and more easily read.  We use Uniplus+
> System V.
> 					tanks,

On our system /etc/profile has the following:

-sh | -rsh)
	trap : 1 2 3
	cat /etc/motd
	.
	.
	.
	;;
-su)
	:
	;;
esac
trap 1 2 3

I think that this is basicly the way AT&T distributed it.
-- 

Alan Fargusson.

{ ihnp4, amdahl, mot }!drivax!alan

sml@luke.UUCP (Steven List) (06/24/85)

In article <168@megad.UUCP> seth@megad.UUCP (Seth H Zirin) writes:
>The message of the day ("/etc/motd") is printed in the cronlog file every
>time an "su - user -c command" is executed by cron.  Does anyone know how
>to supress the "printing" of /etc/motd when using the "-" option to su?
>It would make the cronlog smaller and more easily read.  We use Uniplus+
>System V.

The appearance of the message of the day is caused by the execution of
the user's .profile or the system /etc/cshprofile.  The first question
is: Is it essential to use the `-' option to su?  If it is essential,
you will need to set up some kind of trigger to allow you to
conditionally ignore that part of the initialization sequence.  One
alternative is to set up an alternate user name (nameX), and use the
alternate user name in crontab.  Then you can include the appropriate
conditional code in .profile or /etc/cshprofile.

naftoli@aecom.UUCP (Robert N. Berlinger) (07/01/85)

> > The message of the day ("/etc/motd") is printed in the cronlog file every
> > time an "su - user -c command" is executed by cron.  Does anyone know how
> > to supress the "printing" of /etc/motd when using the "-" option to su?
> > It would make the cronlog smaller and more easily read.  We use Uniplus+
> > System V.

Change the line that says 'cat /etc/motd' to:

if [ -t ]
then cat /etc/motd
fi

The cat will only execute if the standard output is a terminal.
-- 
Robert Berlinger
...{philabs,cucard,pegasus,ihnp4,rocky2}!aecom!naftoli