[Sunhelp] Disk quota by group.
Stu Slimp
stuslimp at technow.com
Thu Jul 22 14:02:45 CDT 1999
--------------58947378BEF0962F5E6D4D0A
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
John Kennedy wrote:
> We do need the quota. We just don't need it for users. We need it for
> departments.
> John
This works:
#!/bin/sh
#
# warns admin when group usage is over quota
fs=/app/graphics
gid=120
admin=root
quota=200000
users=`
awk -F: '$4=="'$gid'" {
if (cnt++==0)
users = "/ " $1 "[ $]"
else
users = users "| " $1 "[ $]"
}
END {
users = users "/"
print users
}' /etc/passwd
`
usage=`
quot $fs |
awk "$users"' {sum += $1}
END {print sum}'
`
if [ "$usage" -gt "$quota" ]
then
echo "Group $gid quota $quota usage $usage" |
mailx -s "$gid over quota" $admin
fi
Stu Slimp
--------------58947378BEF0962F5E6D4D0A
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<HTML>
John Kennedy wrote:
<BLOCKQUOTE TYPE=CITE>We do need the quota. We just don't need it
for users. We need it for
<BR>departments.
<BR>John</BLOCKQUOTE>
<P>This works:
<PRE><FONT FACE="Courier New,Courier">#!/bin/sh
#
# warns admin when group usage is over quota
fs=/app/graphics
gid=120
admin=root
quota=200000
users=`
awk -F: '$4=="'$gid'" {
if (cnt++==0)
users = "/ " $1 "[ $]"
else
users = users "| " $1 "[ $]"
}
END {
users = users "/"
print users
}' /etc/passwd
`
usage=`
quot $fs |
awk "$users"' {sum += $1}
END {print sum}'
`
if [ "$usage" -gt "$quota" ]
then
echo "Group $gid quota $quota usage $usage" |
mailx -s "$gid over quota" $admin
fi</FONT></PRE>
Stu Slimp</HTML>
--------------58947378BEF0962F5E6D4D0A--
More information about the SunHELP
mailing list