Shows usage if option is unset

This commit is contained in:
Naglfar
2022-03-28 23:26:01 +02:00
parent 5e6cdbcc3f
commit a87fad8bba
2 changed files with 18 additions and 11 deletions

15
makedb
View File

@@ -8,9 +8,12 @@ USER=$1
DATABASE=$1
PASSWORD=`pwgen -1B 24`
#adding a new database
create_database
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
if [ -z "$1" ]
then
echo -e "adding a new database for given username."
echo -e "usage: $(basename $0) <username>"
else
create_database
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