Script to alert when Root Password Expiry in AIX Script to alert when Root Password Expiry in AIX shell shell

Script to alert when Root Password Expiry in AIX


you can do it like,

lastupdate=lssec -f /etc/security/passwd -a lastupdate -s <username> | cut -d " " -f2 |cut -d "=" -f2

maxage=lsuser -a maxage itimadm | cut -d " " -f2 |cut -d "=" -f2 maxage=$(($maxage*7))

expires=$(($lastupdate+(60*60*24*$maxage)))expire_date=perl -le 'print scalar localtime $expires

daysremaining=ceil((($expires - $now) / (60*60*24)) - 1)

echo $username,$maxage,$expire_date,$daysremaining

Though this is not full fledged script but logic is present (improvement is possible :) ) and you can add if clause for checking condition (daysremaining<10) then call your mailing script which will send mail to respective users.