X-Git-Url: https://git.hcoop.net/hcoop/scripts.git/blobdiff_plain/42255e0b020923e3564c289ec17f6a1017f2052d..b570f73ebed6506c6456be45b1574b0e57f22990:/create-user-database diff --git a/create-user-database b/create-user-database index bc2ca60..ce65464 100755 --- a/create-user-database +++ b/create-user-database @@ -8,20 +8,24 @@ USER=$1 PATHBITS=`echo $USER | head -c 1`/`echo $USER | head -c 2`/$USER DBPATH=/srv/databases/$PATHBITS PGDIR=$DBPATH/postgres +PGNEWDIR="$DBPATH/postgres-9" MYSQLDIR=$DBPATH/mysql # Create postgres user and tablespace placeholder within volume # FIXME: This assumes the status-quo of database accounts not being # removed by destroy-user... -if ! test -d $PGDIR; then - mkdir -p $PGDIR - chown postgres:postgres $PGDIR - sudo -u postgres psql -c "CREATE TABLESPACE \"user_$USER\" OWNER postgres LOCATION '$PGDIR'" template1 +if ! test -d $PGNEWDIR; then +# postgres 9.1 + mkdir -p $PGNEWDIR + chown postgres:postgres $PGNEWDIR + chmod 700 $PGNEWDIR + sudo -u postgres psql --cluster 9.1/main -c "CREATE TABLESPACE \"user_$USER\" OWNER postgres LOCATION '$PGNEWDIR'" template1 fi # Create mysql user and databases placeholder within volume # FIXME: Same as postgres... if ! test -d $MYSQLDIR; then mkdir -p $MYSQLDIR + chmod 700 $MYSQLDIR chown mysql:mysql $MYSQLDIR -fi \ No newline at end of file +fi