9 sudo
-u postgres psql
-h postgres
-c "CREATE USER $USERNAME" template1
10 sudo
-u postgres psql
-h postgres
-c "ALTER TABLESPACE user_$USERNAME OWNER TO $USERNAME"
17 DBNAME
="${USERNAME}_${DBNAME_BASE}"
19 if [ -n "$ENCODING" ]; then
20 ENCODING
="-E $ENCODING"
23 sudo
-u postgres createdb
-h postgres
-O $USERNAME -D user_
$USERNAME $ENCODING $DBNAME
29 DBNAME
="${USERNAME}_${DBNAME_BASE}"
31 sudo
-u postgres dropdb
-h postgres
$DBNAME
35 echo "Usage: domtool-postgres [adduser <user> | createdb <user> <db> | dropdb <user> <db>]"