#!/bin/ksh
let DDD=`date +%s`/86400 let WARN=83 let EXP=90 echo `hostname` user password expire status checked on `date` >/tmp/expire_user admin="cheenle@domain.com"
while read USER do username=`echo $USER|awk -F ":" '{print $1}'` Passwd_Change_date=`echo $USER|awk -F ":" '{print $3}'` Passwd_length=`echo $USER|awk -F ":" '{print $5}'` let Pass_date=${DDD}-${Passwd_Change_date} # echo $username "password has been changed:" $Pass_date if test ${Pass_date} -gt ${WARN} && test ${Pass_date} -lt ${EXP} then let Expire_day=90-$Pass_date echo " UserID \"$username\" password will expire in $Expire_day days" >>/tmp/expire_user let mail=1 fi
done < /etc/shadow
if test $mail -eq 1 then cat /tmp/expire_user|mail -s "`hostname` user password expire status checked on `date`" $admin
fi
|