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