1. #!/bin/bash
  2.  
  3. # Author: Ryan Lewis
  4. # Date: Mon Feb 27, 2006
  5. # cosiguest-purge: When executed, checks if cosiguest is logged in and
  6. #                  purges their home directory if not.
  7.  
  8.  
  9. LOGON="cosigues"
  10. NUMLOGONS=`w | grep $LOGON | wc -l`
  11. RM=`which rm`
  12.  
  13. if [ $NUMLOGONS -eq 0 ]; then
  14.    echo "Purge of $LOGON initialized."
  15.    cd /home/cosiguest
  16.    $RM -rf *
  17.    echo "Purge of $LOGON complete."
  18. else
  19.    echo "$LOGON is logged in, nothing to be done."
  20. fi