Last active
August 29, 2015 13:58
-
-
Save denysbutenko/1d04735223448e142349 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ROOTPASS=$(cat /root/.passwd) | |
echo "Enter username to delete:" | |
read USERNAME | |
mysql -uroot --password=$ROOTPASS -e "DROP USER $USERNAME@localhost" | |
mysql -uroot --password=$ROOTPASS -e "DROP DATABASE $USERNAME" | |
rm -f /etc/nginx/sites-enabled/$USERNAME.conf | |
rm -f /etc/nginx/sites-available/$USERNAME.conf | |
rm -f /etc/php5/fpm/pool.d/$USERNAME.conf | |
rm -f /etc/uwsgi/apps-enabled/$USERNAME.ini | |
find /var/log/nginx/ -type f -name "$USERNAME-*" -exec rm '{}' \; | |
service nginx reload | |
service php5-fpm reload | |
service uwsgi reload | |
userdel -rf $USERNAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment