#!/usr/local/bin/bash

# Hopefully, this never has to be used.
# Cleans up and removes a user from the system.
# gbmor <ben@gbmor.dev>

echo "Removing user $1 from the system"
userdel $1
echo "Cleaning /home and /var/www/users"
rm -rf /home/$1
rm -rf /var/www/users/$1
echo "Removing httpd config"
rm -f /etc/httpd/$1.conf
httpdpid=`pgrep httpd | awk 'NR==1{print $1}'`
kill -HUP $httpdpid
echo "Done! Don't forget to remove the appropriate include line from httpd-vusers.conf"
