#!/bin/bash LIST_NAME="thunix-join@lists.tildeverse.org" echo "This will remove user account $1 from Thunix." echo "It is assumed the user account has been un-enforced in Ansible as well." echo "Unsubscribe from this list..." echo "From: $1 Subject: unsubscribe " | sudo -u $1 mail $LIST_NAME echo "Killing user processes..." sudo pkill -9 -U $1 echo "Archiving home dir..." sudo tar cfz /root/backups/$1.tgz /home/$1 sudo rm -rf /home/$1 echo "Deleting account from system..." sudo userdel $1 echo "User $1 removed from system. Make sure user is unenforced in ansible." | sudo mail -s "User Account $1 removed from Thunix" root@thunix.net