#!/bin/sh

# Use fuser to kill all processes in AFS. Necessary in order to shut down 
# AFS cleanly.

# wingc - jul 11 2002

if [ $# -ne 1 ]; then
	echo "Usage: killafs <signal name>"
	echo "(use fuser -l to list allowed names)"
	exit 1
fi

if mount | grep -q ' on /afs '; then
  /sbin/fuser -$1 -km /afs >/dev/null

  # If the processes are still there, sleep a while to give them a chance to 
  # die.

  /sbin/fuser -m /afs >/dev/null
  if [ $? -eq 0 ]; then
      sleep 5
  fi
fi
