A script that allows admins of thunix to make user accounts easily.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
335 B

#!/bin/bash
CONFIG=./setenv
. $CONFIG
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