#!/bin/sh #Modified by spiros 6/96 #Re-written by spiros 11/96 tmpwarn=/tmp/expwarn oldwarn=/tmp/expold orged=/etc/expirydates tmped=/tmp/expirydates.new #Get the date in GMT. Actually we are concerned only for the date not the time! today=`date` y=`echo "$today" | awk '{printf $NF}'` m=`/bin/date +%m` now="$y$m" /bin/echo "\c" > $tmped; /bin/echo "\c" > $tmpwarn; /bin/echo "\c" > $oldwarn; for i in `cat $orged`; do u=`echo $i | awk -F: '{print $1}'` e=`echo $i | awk -F: '{print $2}'` case $e in 'never') echo $i >> $tmped; ;; 'expired') echo $i >> $tmped; echo "$u" >> $oldwarn ;; 'expiring') echo "$u":expired >> $tmped; echo "$u" >> $tmpwarn ;; 'notified') echo "$u":expiring >> $tmped; /usr/local/bin/freeze "$u" >/dev/null 2>&1 ;; *) me=`echo $e | awk -F- '{printf("%.2d\n",$2)}'` ye=`echo $e | awk -F- '{printf("%.4d\n",$3)}'` exp="$ye$me" if [ $now -lt $exp ]; then echo $i >> $tmped; continue; elif [ $now -ge $exp ]; then /usr/ucb/mail -s "Expiring Account" $u << EOT Dear $u, Your account expires at the end of this month. In order to maintain the account beyond that date, please contact your system administrator as soon as possible. In two month period from now, your files will be removed from the system. Note 1: At the end of this month your account will be AUTOMATICALLY DISABLED. Note 2: The standard procedure for expiry date extension is an application resubmission . The laboratory is open from 9:30 till 19:30 and our phone number is 772-1537 Your system administrator. EOT echo "$u":notified >> $tmped; fi esac done mv -f $tmped $orged if [ ! -s "$tmpwarn" ]; then echo "There were no expiring acounts for this month." > "$tmpwarn" fi echo " " >>$tmpwarn echo "Accounts listed above expired, MOVE THEM TO THE TAPE" >>$tmpwarn echo "Accounts listed below, expired months ago, move them also to the tape" >>$tmpwarn echo " " >>$tmpwarn cat $oldwarn >> $tmpwarn /usr/ucb/mail -s "Expiring Users" staff < $tmpwarn rm -f $tmpwarn rm -f $oldwarn