quota_check.pl

A while back I was looking for a script that would email warnings if a user was over their disk quota. Surprisingly, I couldn't find one, so I wrote one.

Here's quota_check.pl, for what it's worth: A Small but Useful(tm) utility to check quotas and send emails periodically. Depends on Perl's Quota module. Meant to be called from cron like so:

for i in /filesystem/* ; do [ -d $i ] && quota_check.pl -u $(basename $i) -f $(dirname $i) ; done

It will check whether the user is at or above the warning level (default: 80%) their quota for inodes or blocks. If so, it will see if a warning has been sent recently (default: 7 days) by looking for the file ".quotawarningsent" in their home directory. This file is maintained by the script, and hold the time (in seconds since the epoch) the last warning was sent. If it's time to send another warning, or if one was never sent in the first place, it'll send it and update this file.

Released under the GPLv3. Share and enjoy!