Add database name as optional parameter
This commit is contained in:
parent
6936609ff1
commit
14c099b5fb
10
makedb
10
makedb
|
@ -5,13 +5,19 @@ CONFIG=./setenv
|
||||||
. include/functions
|
. include/functions
|
||||||
|
|
||||||
USER=$1
|
USER=$1
|
||||||
DATABASE=$1
|
|
||||||
PASSWORD=`pwgen -1B 24`
|
PASSWORD=`pwgen -1B 24`
|
||||||
|
|
||||||
|
if [ $# -eq 2 ]
|
||||||
|
then
|
||||||
|
DATABASE=$2
|
||||||
|
else
|
||||||
|
DATABASE=$1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$1" ]
|
if [ -z "$1" ]
|
||||||
then
|
then
|
||||||
echo -e "adding a new database for given username."
|
echo -e "adding a new database for given username."
|
||||||
echo -e "usage: $(basename $0) <username>"
|
echo -e "usage: $(basename $0) <user name> [database name]"
|
||||||
else
|
else
|
||||||
database_create
|
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" $USER@thunix.net
|
||||||
|
|
Loading…
Reference in New Issue