As the fam maintainer (or is it the debian package maintainer? I don't now) did 
not fix that bug
for several years now I gave up waiting for a solution.

I am not a linux guru at all and this solution may be kinda home-style cooking, 
but for me it works.

1. Create a file named famdguard in a directory of your choice <YourDir> with 
the following content:
--- snip --------------------------------------------------------
#!/bin/sh
set -x
COUNT=0
# init the loop control variable
USAGE=100

# Check three times if the famd process is above xx%
# Restart fam if that is the case.
# Set MAXUSAGE to 80 for a single core machine
# Set it to 45 for a dual core machine (one processor completely used)
# Set it to 22 for a quad core machine (one processor completely used)
MAXUSAGE=45
while [ 0$USAGE -gt $MAXUSAGE ]; do
  # get the cpu usage for the fam process
  USAGE=`ps -eo pcpu,pid -o comm= | sort -k1 -n -r | grep famd | awk '{ print 
$1 }'`
  # remove the fractional part of the cpu usage value
  USAGE=${USAGE%%.*}

  # Increment COUNT if fam's cpu usage is above MAXUSAGE
  [ 0$USAGE -gt $MAXUSAGE ] && COUNT=`expr $COUNT + 1`
  if [ $COUNT -gt 2 ]; then
    # Three times high CPU usage. Stop and Restart famd
    /etc/init.d/fam stop
    # Check, if it was successfull or try to kill famd
    ps -e | grep famd
    [ $? -eq 0 ] && killall -9 famd
    # Restart fam
    /etc/init.d/fam start
    exit
  fi
  # Wait some time before the next loop
  sleep 30
done
--- snap --------------------------------------------------------

This file checks for the CPU usage of fam. 
If it is above the MAXUSAGE it checks two times more with a delay of 30 
seconds. 
If CPU usage is above MAXUSAGE 3 times the fam deamon is stopped and started 
again.

2. make that file executable
$ chmod +x <YourDir>/famdguard

3. add the following line into your /etc/crontab to perform the check every 10 
minutes

# Check for famd running wild
*/10 * * * *   root       /<YourDir>/famdguard





-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to