motd and xenix

Bob Kamins bob at bbm.UUCP
Fri Apr 14 04:53:03 AEST 1989


In article <185 at berner.UUCP> richard at 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 at bbm.UUCP : 305-1500 Don Mills Road   :
: 416-445-9800 : Don Mills Ontario M3B 3L7 :



More information about the Comp.unix.xenix mailing list