Skip to content

Instantly share code, notes, and snippets.

@antk25
Last active July 6, 2018 21:50
Show Gist options
  • Save antk25/260a3277863a603b50f7b602c6f1aee8 to your computer and use it in GitHub Desktop.
Save antk25/260a3277863a603b50f7b602c6f1aee8 to your computer and use it in GitHub Desktop.
[Удаление сайта и пользователя с сервера] #server
#!/bin/bash
ROOTPASS='password'
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/php/7.0/fpm/pool.d/$USERNAME.conf
find /var/log/nginx/ -type f -name "$USERNAME-*" -exec rm '{}' \;
/etc/init.d/nginx reload
/etc/init.d/php7.2-fpm reload
userdel -rf $USERNAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment