mirror of
https://github.com/ThunixdotNet/makeuser.git
synced 2026-01-24 13:40:17 +00:00
Adding a db removal tool.
This commit is contained in:
14
dbremove
Executable file
14
dbremove
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
ADMIN_EMAIL="root@thunix.net"
|
||||||
|
USER=$1
|
||||||
|
|
||||||
|
sudo mysqldump -u root $USER > /tmp/$USER.sql
|
||||||
|
sudo mv /tmp/$USER.sql /root/$USER.sql
|
||||||
|
|
||||||
|
sudo mysql -u root << _EOF
|
||||||
|
DROP DATABASE $USER;
|
||||||
|
FLUSH PRIVILEGES;
|
||||||
|
_EOF
|
||||||
|
|
||||||
|
echo "The databases for $USER has been archived, and removed." | sudo mail -s "Database for $USER has been removed" $ADMIN_EMAIL
|
||||||
|
|
||||||
Reference in New Issue
Block a user