home *** CD-ROM | disk | FTP | other *** search
- #
- # script that naughty people get when they don't remove files
- #
- trap '' 2 3
- stty erase ^H kill ^U echoe intr ^? quit ^\
- SHELL=/bin/sh
- export SHELL PATH
- #
- # re-check the disk allocation
- #
- DQUOTAS=/usr/local/lib/disk # directory containing all the info
- HOG=1
- echo "\nOvernight check shows you have too much disk space"
- while [ "$HOG" = "1" ]
- do
- PATH=/bin:/usr/bin:/usr/ucb
- echo "Re-checking your disk usage .... \c"
- ALLOWED=`grep $LOGNAME $DQUOTAS/allowed | awk '{print $2}'`
- DISK=`du -s . | awk '{print $1}'`
- echo "done"
- if [ "$DISK" -gt "$ALLOWED" ]
- then
- echo "You have $DISK blocks, but are allowed only $ALLOWED"
- echo "You must remove some files before you can logon"
- echo "You now have a restricted shell with the following commands"
- ls -C /diskhog /usr/diskhog
- echo "Remove some files and then type CONTROL-D"
-
- #
- # if we allow interrupts in this shell, we get zapped on return
- # so - fork a shell, and allow interrupts there
- # we have to give a command to trap, so that spawned commands get SIG_DFL,
- # or we can't reset them when we get there!
- # You may have to say "trap 3" to unlock the QUIT signal.
- #
- trap 'echo "** interrupt ignored **"' 2 3
- /bin/sh << EOF
- PATH=/diskhog:/usr/diskhog
- SHELL=/bin/rsh
- export PATH SHELL
- exec /bin/rsh < /dev/tty # signals get set to SIG_DFL
- EOF
- trap '' 2 3 # ignore SIGINT SIGQUIT
- else
- echo "I see that you have removed your excess disk blocks - thankyou"
- nohog
- HOG=0
- chmod og+rx $HOME
- fi
- done
-