source: trunk/debathena/debathena/dotfiles/quotawarn.sh @ 23832

Revision 23832, 1.6 KB checked in by geofft, 15 years ago (diff)
In dotfiles: * Also don't run 'mailquota' on EXCHANGE.MIT.EDU accounts for now (although as of mitmailutils >= 10.1.0-0debathena3, this is only a cosmetic problem).
Line 
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.
6qline=`quota.debathena -v -f "$USER" | awk '/^\// {print}'`
7usage=`echo "$qline" | awk '{print $2}'`
8quota=`echo "$qline" | awk '{print $3}'`
9quota90=`expr "${quota:-0}" \* 9 / 10`
10
11if [ -n "$usage" -a -n "$quota" ] && [ "$usage" -ge "$quota" ]; then
12  zenity --error --text="
13Your home directory usage exceeds your quota (${usage}KB
14used out of ${quota}KB).  You will be unable to use
15Athena normally until you free up space by deleting
16unneeded files.  You may find the following command
17useful to identify unneeded files:
18
19  athrun consult helpquota"
20elif [ -n "$usage" -a -n "$quota90" ] && [ "$usage" -ge "$quota90" ]; then
21  zenity --info --text="
22Your home directory usage is near your quota (${usage}KB
23used out of ${quota}KB).  Consider removing unneeded
24files to free up space.  You may find the following
25command useful to identify unneeded files:
26
27  athrun consult helpquota"
28fi
29
30# mitmailutils doesn't do Exchange yet
31if hesinfo "$USER" pobox | grep -q EXCHANGE; then
32  exit
33fi
34
35# Determine the user's mail usage and quota.
36qline=`mailquota | tail +2`
37usage=`echo "$qline" | awk '{print $2}'`
38quota=`echo "$qline" | awk '{print $3}'`
39quota90=`expr "${quota:-0}" \* 9 / 10`
40
41if [ -n "$usage" -a -n "$quota90" ] && [ "$usage" -ge "$quota90" ]; then
42  zenity --info --text="
43Your MIT mail usage is close to or exceeding your mail
44quota (${usage}KB used out of ${quota}KB).  Consider
45removing unneeded mail messages to free up space.  You
46may find the following command useful to identify which
47mail folders need the most attention:
48
49  mailusage"
50fi
Note: See TracBrowser for help on using the repository browser.