10

Expired user alert

view full story
linux-howto

http://www.unix.com – Dear Expert, I have made a script for check the expired user and it will send alert if the password will expire less than 8 days. Code: #!/bin/ksh # Script for check who will expired the password # currentdate=`perl -le 'print time'` changeperiod=`echo $((84*86400))` remindperiod=`echo $((8*86400))` alertperiod=`echo"($changeperiod - $remindperiod)"` lastchange=`awk '/:/ {name=$1} ; /lastu/ {print name $3}' /etc/security/passwd` for user in $lastchange do username=`echo $user | cut -f 1 -d:` lastupdate=`echo $user | cut -f 2 -d:` alertdate=`echo "$alertperiod + $lastupdate (HowTos)