Set +x on create-user-database script
[clinton/scripts.git] / create-user-database
CommitLineData
82cda9f8
CE
1#!/bin/bash -ex
2
3# DO NOT EXECUTE DIRECTLY
4# This is only to be executed by create-user
5
6PATHBITS=$1
7DBPATH=/srv/databases/$PATHBITS
8PGDIR=$DBPATH/postgres
9MYSQLDIR=$DBPATH/mysql
10
11# Create postgres user and tablespace placeholder within volume
12if ! test -d $PGDIR; then
13 mkdir -p $PGDIR
14 chown postgres:postgres $PGDIR
15fi
16
17sudo -u postgres psql -c "CREATE TABLESPACE user_$USER OWNER postgres LOCATION '$PGDIR'" template1
18fi
19
20# Create mysql user and databases placeholder within volume
21mkdir -p $MYSQLDIR
22chown mysql:mysql $MYSQLDIR