move code to a function and add usage options

This commit is contained in:
Naglfar 2020-04-29 23:39:09 +02:00
parent e74b9287dc
commit f9c526342e
1 changed files with 21 additions and 12 deletions

11
rmuser
View File

@ -3,6 +3,15 @@ CONFIG=./setenv
. $CONFIG . $CONFIG
if [ -z $1 ]
then
echo -e "Usage: `basename $0` [ username ]"
else
remove_user $1
fi
remove_user()
{
echo "This will remove user account $1 from Thunix." 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 "It is assumed the user account has been un-enforced in Ansible as well."
@ -20,4 +29,4 @@ echo "Deleting account from system..."
sudo userdel $1 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" $ADMIN_EMAIL echo "User $1 removed from system. Make sure user is unenforced in ansible." | sudo mail -s "User Account $1 removed from Thunix" $ADMIN_EMAIL
}