[22517] | 1 | #!/bin/sh |
---|
| 2 | |
---|
[22631] | 3 | # $Id: quotawarn.sh,v 1.4 2007-04-09 17:13:19 ghudson Exp $ |
---|
[22541] | 4 | |
---|
[22517] | 5 | # Determine the user's home directory usage and quota. |
---|
[22913] | 6 | qline=`quota.debathena -v -f "$USER" | awk '/^\// {print}'` |
---|
[22517] | 7 | usage=`echo "$qline" | awk '{print $2}'` |
---|
| 8 | quota=`echo "$qline" | awk '{print $3}'` |
---|
[22631] | 9 | quota90=`expr "${quota:-0}" \* 9 / 10` |
---|
[22517] | 10 | |
---|
[22631] | 11 | if [ -n "$usage" -a -n "$quota" ] && [ "$usage" -ge "$quota" ]; then |
---|
[22517] | 12 | zenity --error --text=" |
---|
| 13 | Your home directory usage exceeds your quota (${usage}KB |
---|
| 14 | used out of ${quota}KB). You will be unable to use |
---|
| 15 | Athena normally until you free up space by deleting |
---|
| 16 | unneeded files. You may find the following command |
---|
| 17 | useful to identify unneeded files: |
---|
| 18 | |
---|
| 19 | athrun consult helpquota" |
---|
[22631] | 20 | elif [ -n "$usage" -a -n "$quota90" ] && [ "$usage" -ge "$quota90" ]; then |
---|
[22565] | 21 | zenity --info --text=" |
---|
[22517] | 22 | Your home directory usage is near your quota (${usage}KB |
---|
| 23 | used out of ${quota}KB). Consider removing unneeded |
---|
| 24 | files to free up space. You may find the following |
---|
| 25 | command useful to identify unneeded files: |
---|
| 26 | |
---|
| 27 | athrun consult helpquota" |
---|
| 28 | fi |
---|
| 29 | |
---|
| 30 | # Determine the user's mail usage and quota. |
---|
| 31 | qline=`mailquota | tail +2` |
---|
| 32 | usage=`echo "$qline" | awk '{print $2}'` |
---|
| 33 | quota=`echo "$qline" | awk '{print $3}'` |
---|
[22631] | 34 | quota90=`expr "${quota:-0}" \* 9 / 10` |
---|
[22517] | 35 | |
---|
[22631] | 36 | if [ -n "$usage" -a -n "$quota90" ] && [ "$usage" -ge "$quota90" ]; then |
---|
[22565] | 37 | zenity --info --text=" |
---|
[22517] | 38 | Your MIT mail usage is close to or exceeding your mail |
---|
| 39 | quota (${usage}KB used out of ${quota}KB). Consider |
---|
| 40 | removing unneeded mail messages to free up space. You |
---|
| 41 | may find the following command useful to identify which |
---|
| 42 | mail folders need the most attention: |
---|
| 43 | |
---|
| 44 | mailusage" |
---|
| 45 | fi |
---|