next up previous contents
Next: daemons.sh Up: Scripts di usability Previous: updateuser.sh   Indice

rmnode.sh

#!/bin/bash

. cluster.conf

if [ ! -d $TFTPDIR/$1 ] ; then
  echo "I don't know $1!" 
  exit 1
fi

echo -n "Remove $1 ? (y/n) "
read x
if [ -z $x ] ; then exit ; fi
if [ $x = "n" ] ; then
  echo "Well.."
  exit 0
fi
if [ $x = "y" ] ; then
  echo -n "Yes?!? (y/n) "
  read x
  if [ -z $x ] ; then exit ; fi
  if [ $x = "n" ] ; then
    echo "Ahh.. It was no!"
    exit 0
  fi
  if [ $x = "y" ] ; then
    echo -n "Ok... "
    chattr -i $TFTPDIR/$1/fastboot
    rm -fr $TFTPDIR/$1
    rm -f $TFTPDIR/pxelinux.cfg/$( cat $DHCP | grep $1\
     | awk {'print "01-"$6'} | tr -d ";" | tr [A-Z] [a-z] | tr ":" "-" )
    echo "Bye!" 
  fi
fi



Mario Cavicchi 2004-07-22