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 | if hash mailquota 2>/dev/null; then |
---|
33 | # Determine the user's mail usage and quota. |
---|
34 | qline=`mailquota | tail -n +2` |
---|
35 | usage=`echo "$qline" | awk '{print $2}'` |
---|
36 | quota=`echo "$qline" | awk '{print $3}'` |
---|
37 | warnlevel=`expr "${quota:-0}" - ${tolerance}` |
---|
38 | |
---|
39 | if [ -n "$usage" -a -n "$warnlevel" ] && [ "$usage" -ge "$warnlevel" ]; then |
---|
40 | zenity --info --text=" |
---|
41 | Your MIT mail usage is close to or exceeding your mail |
---|
42 | quota (${usage}KB used out of ${quota}KB). Consider |
---|
43 | removing unneeded mail messages to free up space. You |
---|
44 | may find the following command useful to identify which |
---|
45 | mail folders need the most attention: |
---|
46 | |
---|
47 | mailusage" |
---|
48 | fi |
---|