[8116] in SIPB bug reports
wrapper script for pine
daemon@ATHENA.MIT.EDU (peeto de la noche)
Mon Jul 15 14:25:05 2002
Date: Mon, 15 Jul 2002 14:29:15 -0400 (EDT)
From: peeto de la noche <gamache@ftso.org>
To: bug-sipb@mit.edu
here is a wrapper script for pine to alert users if they're using 90% or
more quota, and give them a chance to bail. pine is assumed to be named
'pine.real' somewhere in the user's $PATH.
-peeto
#!/usr/athena/bin/perl
#
# wrapper script to make sure pine doesn't eat mail
# gamache 15 july 2002
#
use strict;
my @quota_out = split "\n", `quota -v`;
my $username = $ENV{USER};
foreach my $line (@quota_out) {
if ( $line=~/$username\s+([0-9]+)\s+([0-9]+)/ ) {
my $used_kb = $1;
my $quota_kb = $2;
if ( $used_kb/$quota_kb >= 0.9 ) {
print <<EOT
WARNING:
You appear to be using 90% or more of your disk quota. If you inc
mail with pine, there is a chance that messages will be lost if you
exceed your disk quota. Proceed anyway? (yes/no)
EOT
;
my $answer = <>;
if (! ($answer=~/^yes\s*$/i || $answer=~/^y\s*$/i) ) {
# anything other than 'y' or 'yes', case-insensitive
print "Aborting.\n\n";
exit 0;
}
}
}
}
exec "pine.real";
-.
\ .-. _ gamache@ftso.org.....www.ftso.org.....pete gamache
---\-----/---\---/-`------------ -.- -... .---- -.. -.. -. -------------
\ / `-' CC10 E03C 2CDD EBDD 46E2 907D FE77 570B 88A4 52EA
`-'