General discussion

Locked

Warn over quota mail users in linux

By cjcknight ·
I have recently implemented a disk quota on one of our Linux Red Hat 7.1 servers. The partition was /home. All are working fine. Is there an application or a script that would notify a particular user if someone has exceeded his quota or would notify if he is approaching 95% of his quota? Please help.


Thanks in advance

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Warn over quota mail users in linux

by cpfeiffe In reply to Warn over quota mail user ...

Your standard quota notices are probably going to your syslog file. You can read output of that file and search for quota errors for a specific user as in the script below

#!/bin/ksh
Q=`grep userid file |grep quota`
if [ -n "$Q" ]; then
mailx -s "quota is nearly met" user@domain.
fi

Basically you grep for the userid from the file and then you grep for quota to make sure it is a quota error and not just an ordinary message. If both criteria is met a mail message is sent to the user. The if statement is saying that if the variable Q is not empty. If Q is empty that means the grep didn't return anything so the user does not need to be emailed. You can run this as often as you like via cron and can even add a date/time check tothe command that sets the Q variable.

Collapse -

Warn over quota mail users in linux

by cjcknight In reply to Warn over quota mail user ...

Poster rated this answer

Collapse -

Warn over quota mail users in linux

by servermonkey In reply to Warn over quota mail user ...

you can set a soft limit of 95% of their allowed space and a hard limit of the 100%.

man edquota should help.

Collapse -

Warn over quota mail users in linux

by cjcknight In reply to Warn over quota mail user ...

Poster rated this answer

Collapse -

Warn over quota mail users in linux

by cjcknight In reply to Warn over quota mail user ...

This question was closed by the author

Back to Linux Forum
5 total posts (Page 1 of 1)  

Operating Systems Forums