home *** CD-ROM | disk | FTP | other *** search
- :
- #!/bin/sh
- # $Id: 1stlogin.sh,v 5.3.2.5 91/09/03 09:55:00 policy USENET $
- #
- # Copyright (c) 1991 by Bergen B. Hovell, Jr.
- # You may not distribute or otherwise use this work for any profit-making
- # purpose without the express permission of the author, but this work is
- # otherwise freely distributable so long as this header remains attached.
- ##################### edit these in the Makefile! ########################
- PATH=
- pager=
- record=
- poldir=
- announcement=
- defterm=
- mssgto=
- name=
- fast=
- ##########################################################################
- IFS="
- "
- export PATH IFS
-
- trap '' 2; # Allow no user interrupts
-
- logdate=`exec 'date'` # Date of record of this announcement
-
- # Let's do it:
- if [ ! -r "$announcement" ]
- then echo "Subject: New-login info failed for '$name' on $logdate!" \
- | mail $mssgto
- else if [ ! "$TERM" ]
- then TERM=$defterm
- export TERM
- noterm=yes
- fi
-
- # Do we have a "clear" function available?
- if [ -x /bin/clear -o -x /usr/bin/clear -o -x /usr/ucb/clear ]
- then clear=`clear`
- # ....or curses?
- elif [ -x /usr/bin/tput ]
- then clear=`tput clear`
- # ....nada....
- else clear=
- fi
-
- # Call up the new-login announcement into the pager, and apologize if
- # we are not a fast machine:
- echo $clear
- $pager $announcement
- echo $clear
- if [ "$fast" != "yes" ]
- then cat << " endmssg"
-
-
-
-
-
-
- ADMINISTRATIVE NOTICE!
-
- * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * *
- * Sorry for the brief delay, but I must do some one- *
- * time tasks related to your first login session. *
- * *
- * Please be patient................................ *
- * *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
-
-
-
-
-
-
- endmssg
- fi
-
- # Create a file for us to test hereafter so this script never runs
- # again for this user:
- cat << " endmssg" > $record
-
- * * * * * * * * * * * * * * * * * * * * * * *
- * NOTICE *
- * *
- * The existence of this file suppresses *
- * the one-time login announcement about *
- * policies on this host. If you remove *
- * this file, that announcement will again *
- * bore you the next time you log in. :-) *
- * *
- * * * * * * * * * * * * * * * * * * * * * * *
-
- Thanks.....System Administrator
- endmssg
- chmod 440 $record
-
- # Notify the administrator that the user has completed his first login and
- # has seen the announcement (or that he did not!):
- if [ -f $record ]
- then echo "Subject: Successful new-login '$name' logged in on $logdate" \
- | mail $mssgto
- else echo "Subject: New-login info failed for '$name' on $logdate!" \
- | mail $mssgto
- fi
-
- # If he didn't have a TERM value coming into this script on this system,
- # then be sure it is null going out:
- if [ "$noterm" ]
- then TERM=""
- export TERM
- fi
-
- fi
-
- # end of file
-