forked from team/makeuser
20 lines
550 B
Bash
Executable File
20 lines
550 B
Bash
Executable File
#!/bin/bash
|
|
|
|
CONFIG=./setenv
|
|
. $CONFIG
|
|
. include/functions
|
|
|
|
USER=$1
|
|
DATABASE=$1
|
|
PASSWORD=`pwgen -1B 24`
|
|
|
|
if [ -z "$1" ]
|
|
then
|
|
echo -e "adding a new database for given username."
|
|
echo -e "usage: $(basename $0) <username>"
|
|
else
|
|
database_create
|
|
sed -e "s/_username_/$USER/g" -e "s/_password_/$PASSWORD/g" include/dbemail.tmpl | sudo mail -s "Your database has been provisioned" $USER@thunix.net
|
|
sed -e "s/_username_/$USER/g" -e "s/_password_/$PASSWORD/g" include/dbemail.tmpl | sudo mail -s "Your database has been provisioned" $ADMIN_EMAIL
|
|
fi
|