[comp.unix.microport] Need to patch inews/rnews so it will watch for inode underflow

stever@tree.UUCP (Steve Rudek) (02/19/89)

Once upon a time I thought 70 megs of storage was massive; then I met usenet!
Now every night before I go to bed I say a little prayer that I won't awake
to an inode underflow caused by an inews that is too stupid to look before it
leaps.
 
Does anyone have a patch for inews which will give it a little intelligence and
allow it to exit rather than corrupt the inode table?
 
If not, can anyone provide me with a C routine to count inodes?  I suppose
I could periodically run "df -t" as a child of inews and catch the result via
a pipe . . . but that would be ugly and slow.   

zeeff@b-tech.ann-arbor.mi.us (Jon Zeeff) (02/20/89)

If you are running out of inodes, you should mkfs with more or, if it's
the inode bug, fix it.  But this script will help.


#
# This demon script (uukill) watches for a lack of space and kills incoming o
# uucico jobs when space is low.
# This is done to prevent a site from sending
# more usenet news than this system can handle.
# Written for HDB uucp.  Non HDB uucp systems may be able to get the pid
# from the TM file name.
#
# Run from /etc/inittab with:
#
#    uk:23:respawn:/etc/uukill
# 
#                        - Jon Zeeff   umix!b-tech!zeeff

PATH=/bin:/usr/bin:/usr/lbin
ADMIN=zeeff

sleep 200
cd /usr/spool/uucp

while true
do
   
      set `df /`
      FREE=$4
      SPOOLFREE=$6
      set `df /usr/spool/news`
      IFREE=$4
      SPOOLIFREE=$6

      if [ $FREE -lt 1500 -o $SPOOLFREE -lt 2000 -o $IFREE -lt 200 -o $SPOOLIFREE -lt 200 ]
         then

         # kill the jobs with LCK files and TM files 
         for i in `uuname`
         do
	    if test -f /usr/spool/locks/LCK..$i && /bin/ls $i/TM*  
            then
               kill `cat /usr/spool/locks/LCK..$i`
            fi 2> /dev/null > /dev/null
         done

         if test ! -f /tmp/full
         then
              echo "Killing uucp - disk is full" > /tmp/full
              df >> /tmp/full
              mail $ADMIN < /tmp/full
         fi
      fi
 
   sleep 500
done

-- 
  Jon Zeeff			zeeff@b-tech.ann-arbor.mi.us
  Ann Arbor, MI			mailrus!b-tech!zeeff

stever@tree.UUCP (Steve Rudek) (02/22/89)

In article <5124@b-tech.ann-arbor.mi.us>, zeeff@b-tech.ann-arbor.mi.us (Jon Zeeff) writes:
> If you are running out of inodes, you should mkfs with more or, if it's
> the inode bug, fix it.  But this script will help.
Thank you for the script.  Thanks even more for the tip on using mkfs to
increase the inode count.  Can anyone give me specific instructions on how
to do this?  As usual, the man entry assumes you don't really need a man
entry.  It says the syntax is "/etc/mkfs special blocks[:i-nodes]"; the
body of the man entry assumes you are Dennis Ritchie's little brother.

I'm running Microport System V/AT 2.4.  Do I need to reinstall the system
to increase the inode count on /usr?  How do I do this?  I don't recall that
the "installit" script which Microport supplies gives you a chance to adjust
the number of inodes--only the distribution of blocks.  Can I do this
directly with mkfs?