[comp.unix.xenix] motd and xenix

richard@berner.UUCP (Richard Greenall) (04/07/89)

If anyone happens to know how to disable the printing of the message of the
day for specific users under XENIX 2.3.2 enlighten me via email?  I have
RTFM'd for it, and am unable to find it.

					Thanks

						Richard

						uunet!dptcdc!berner!richard

bob@bbm.UUCP (Bob Kamins) (04/14/89)

In article <185@berner.UUCP> richard@berner.UUCP (Richard Greenall) writes:
>
>If anyone happens to know how to disable the printing of the message of the
>day for specific users under XENIX 2.3.2 enlighten me via email? .....

     If you want to do none of the users all of the time, you can disable
the motd for all users by renaming or removing the file "/etc/motd".

     If you want to do some of the users all of the time, "mv /etc/motd
/etc/real.motd" and put a line like "cat /etc/real.motd" in the ".login"
file of each user you want to receive the message.

     If you want to do some of the users some of the time (like once a day),
"mv /etc/motd /etc/real.motd", put the line "motd" in the ".login" file of
each user you want to receive the message, and put the following shell
script in a directory on the user's path ("/usr/local/bin" perhaps?):

:
#  motd.sh - displays a message on a user's initial login of the day.
#  There should be a file (as defined by MESSAGE, below) containing the
#  message you want displayed.  If this file doesn't exist, nothing else
#  will happen.  If the file exists and is readable, the user's "flag"
#  file will be created or updated with the current date and the message
#  will be displayed on his terminal.

#  written by Bob Kamins,
#  with special thanks to Mike Stevenson for the suggestion

MESSAGE="/etc/real.motd"
FLAG="$HOME/.motd"

# go no further if there isn't a message...
if [ -f $MESSAGE ] ; then

  # if it doesn't exist, create a flag file in the user's home directory...
  if [ ! -f $FLAG ] ; then
    echo "0" > $FLAG
  fi

  # print the message if the flag file is older than today...
  today=`date +%y%j`
  fdate=`cat $FLAG`
  if [ $today -gt $fdate ]; then
    more $MESSAGE
    rm $FLAG
    echo `date +%y%j` > $FLAG
  fi
fi
-- 
: Bob Kamins   : BBM Bureau of Measurement :
: bob@bbm.UUCP : 305-1500 Don Mills Road   :
: 416-445-9800 : Don Mills Ontario M3B 3L7 :

craigp@summus.UUCP (Craig LeRoy Petty) (04/16/89)

In article <185@berner.UUCP> richard@berner.UUCP (Richard Greenall) writes:
>
>If anyone happens to know how to disable the printing of the message of the
>day for specific users under XENIX 2.3.2 enlighten me via email? .....

Rather than modifying each users login file, you may wish to make use of 
/etc/profile and /etc/cshrc.  These are the systemwide startup files  
associated with each shell (sh and csh respectively).  Each time the
user logs on the system, the respective file will be executed.           
You could write some sort of script or invoke a program which could
determine what type of user is logging on and produce a tailored or even
personalized message. 

Live!      
cp

***************************************************************************
Craig Petty                 Warning: I don't have a spelling checker!
Summus Computer Systems     Product Info: ..uunet!summus!info
17171 Park Row			Personal: ..uunet!summus!craigp
Houston, TX 77084                  Phone: (713) 492-6611
***************************************************************************