source: trunk/debathena/debathena/xsession/debian/quotawarn @ 23449

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