mirror of
https://github.com/ThunixdotNet/makeuser.git
synced 2026-11-06 04:15:38 +00:00
Adding a db removal tool.
This commit is contained in:
1 parent
9bf8982535
commit
3e3838aef2
1 file changed
+14
@@ -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