@ k1eOx
Thanks for the script!
One could also pull the zimbraPasswordMaxAge on a per user base if the default has been changed individualy:
Code:
EXPIREVAL=`zmprov ga $USER zimbraPasswordMaxAge | sed 's/[^0-9]//g'| sed -n '/[0-9]/p'`
EXCRITVAL=$(($EXPIREVAL - $CRITWARNAT ))
EXWARNVAL=$(($EXPIREVAL - $WARNAT ))
Place this in the main loop just below the CHANGEDATE expression.
And dont forget to comment the resp. expressions above ;-)

@k1e0x: There is one small error in your script.
$DIF this is how many days passed since last password change,
Quote:
|
DIF=$(($DAYCHANGE - $DAYCUR))
|
.
You can't use this value to report the remaining days.
If you report the remaining days use a new variable
Code:
REM=$(($EXPIREVAL - $DIF))
and replace $DIF in the elif branches, so it looks like this:
Code:
elif [[ $DIF -ge $EXCRITVAL ]]; then
WARN=1
WARNIT=1
echo -n " ZIMBRA WARNING $USER email password will expire in 1 day."
mail -s "User Password is about to expire." $NOTIFICATION <<-END
The password for user ${USER} will expire in 1 day.
END
mail -s "Your password is about to expire." $USER <<-END
Dear ${USER},
your password will expire in 1 day. It is critical you change
it TODAY.
To change your password please go to ${CHANGEURL},
select Preferences
and change your password in the Login Options section
--
IT Support
END
logger -p cron.info -t PASSWORD_EXPIRE - $USER was notified. $REM days remain.
elif [[ $DIF -ge $EXWARNVAL ]]; then
WARN=1
WARNIT=0
echo -n " WARNING user password will expire in $REM days."
mail -s "Your password is about to expire." $USER <<-END
Dear ${USER},
your password will expire in ${REM} days. If you do not change it soon
you will not be able to login. It would be a good idea to change it now.
To change your password please go to ${CHANGEURL}
Select Preferences
and change your password in the Login Options section
--
IT Support
END
logger -p cron.info -t PASSWORD_EXPIRE - $USER was notified. $REM days remain.
else
WARN=0
WARNIT=0
fi