1 | #!/bin/sh |
---|
2 | |
---|
3 | # $Id: quotawarn.sh,v 1.4 2007-04-09 17:13:19 ghudson Exp $ |
---|
4 | |
---|
5 | # Determine the user's home directory usage and quota. |
---|
6 | qline=`quota.debathena -v -f "$USER" | awk '/^\// {print}'` |
---|
7 | usage=`echo "$qline" | awk '{print $2}'` |
---|
8 | quota=`echo "$qline" | awk '{print $3}'` |
---|
9 | quota90=`expr "${quota:-0}" \* 9 / 10` |
---|
10 | |
---|
11 | if [ -n "$usage" -a -n "$quota" ] && [ "$usage" -ge "$quota" ]; then |
---|
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" |
---|
20 | elif [ -n "$usage" -a -n "$quota90" ] && [ "$usage" -ge "$quota90" ]; then |
---|
21 | zenity --info --text=" |
---|
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}'` |
---|
34 | quota90=`expr "${quota:-0}" \* 9 / 10` |
---|
35 | |
---|
36 | if [ -n "$usage" -a -n "$quota90" ] && [ "$usage" -ge "$quota90" ]; then |
---|
37 | zenity --info --text=" |
---|
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 |
---|