Depends...if you have root access to the external server Why not use the disk quota system (probably already built into your kernel) it has the facility to generate warnings and stop writes at different levels of fullness.
The only time I used it I was setting quotas for individual groups but I am sure you could set it up as a wildcard group with ease.
Looking back at my notes from about 5 years ago when I did this, I had done the following
Compiled the quota support into the kernel (probably already there nowadays)
ran /sbin/quotacheck -avug and /sbin/quotaon -avug at startup as part of my init scripts.
then there are a couple of mods to fstab and a user.quota and group.quota.
Then I had this script (sorry about the state of this, it was an early point in my days of mucking about with linux)
Watch the wrapping.
#! /bin/bash # Wayne Stallwood 2001 # A little script to check the status of quota's on a system and mail somebody if the soft quota is breached # Add details of each group/user to the bottom of this file as directed by the comments below # You also need to make sure that quotainit.sc is run at system startup ,that the filesystems concerned # Are mounted with either the usrquota or grpquota tags in fstab and the user.quota and group.quota files have been created
HEADER=/home/wayne/bailheader.conf TODAY=$(date +%Y%m%d) OTHERDAY=$(date --date '6 days')
function telltale () { echo 'The' "$@" 'Group on' $HOSTNAME 'have exceeded their allocated space' >> /home/wayne/output.msg echo 'Please Conact Wayne or The CVS Admin to Beg for some more'
/home/wayne/output.msg
echo 'or to get someting old removed,' >> /home/wayne/output.msg echo 'Failure to do this may result in the' "$@" 'Group being unable to commit' >> /home/wayne/output.msg echo 'anything else into CVS from' $OTHERDAY 'Or even before if they keep adding stuff !' >> /home/wayne/output.msg less $HEADER >> /home/wayne/output.msg /usr/sbin/sendmail $MAILUSER < /home/wayne/output.msg rm /home/wayne/output.msg touch '/root/'$@'havebeentold'
}
function allfine () { echo 'The' "$@" 'Group on' $HOSTNAME 'have reduced their used space'
/home/wayne/output.msg
echo 'The previous warnings can now be ignored'
/home/wayne/output.msg
less $HEADER >> /home/wayne/output.msg /usr/sbin/sendmail $MAILUSER < /home/wayne/output.msg rm /home/wayne/output.msg rm -f '/root/'$@'havebeentold' }
function checkit () { if [ -e '/root/'$@'havebeentold' ] then quota -u $GROUPNAME | grep "*" || allfine $@ else quota -u $GROUPNAME | grep "*" && telltale $@ fi } # Add user and group quotas to check here as follows # GROUPNAME=type name of group / user you want to check here as it appears in the passwd file # MAILSUER=type email address of the person you want notified here, multiple addresses may be delimited by a space # If the group name is the same as the mail user you could define MAILUSER=$GROUPNAME'@domain.co.uk' just below # these comments # checkit 'type visible name of group here eg artists, programmers etc' # You can have as many of these as you like, but you must insure that each checkit name is proceeded by a GROUPNAME # and a MAILUSER Otherwise nasty things will happen
GROUPNAME=wayne MAILUSER=wayne@cyberlife.co.uk checkit ITdept