#!/usr/bin/env bash if [ -z "$1" ]; then echo "Usage xen-delete-server.sh " exit fi NAME=$1 echo -n "This will permantely destroy the account, do you wish to continue? (yes/no): " read response if [ $response == "yes" ] || [ $response == "y" ] then echo "Removing ${NAME}..." echo xm destroy ${NAME} lvremove -f /dev/my_volume_group/${NAME} # Remove from backup list grep -v ${NAME} /etc/backup/backup.list > /etc/backup/backup.list.tmp mv -f /etc/backup/backup.list.tmp /etc/backup/backup.list echo "${NAME} has been removed from the system." rm -fv /etc/xen/auto/${NAME}.cfg else echo "Aborting." exit fi