7 sudo
-u postgres psql
-h postgres
-c "CREATE USER $USERNAME" template1
8 sudo
-u postgres psql
-h postgres
-c "ALTER TABLESPACE user_$USERNAME OWNER TO $USERNAME"
15 DBNAME
="${USERNAME}_${DBNAME_BASE}"
17 if [ -n "$ENCODING" ]; then
18 ENCODING
="-E $ENCODING"
21 sudo
-u postgres createdb
-h postgres
-O $USERNAME -D user_
$USERNAME $ENCODING $DBNAME
27 DBNAME
="${USERNAME}_${DBNAME_BASE}"
29 sudo
-u postgres dropdb
-h postgres
$DBNAME
33 echo "Usage: domtool-postgres [adduser <user> | createdb <user> <db> | dropdb <user> <db>]"