Create database tablespace stubs on fritz
[clinton/scripts.git] / create-user
index 7ad5114..5659b3f 100755 (executable)
@@ -45,6 +45,17 @@ function mire_and_deleuze() {
     ssh mire.hcoop.net $*
 }
 
     ssh mire.hcoop.net $*
 }
 
+function execute_on_fritz () {
+    ssh fritz.hcoop.net $*
+}
+
+function execute_on_all_machines () {
+    $*
+    ssh mire.hcoop.net $*
+    ssh hopper.hcoop.net $*
+    ssh fritz.hcoop.net $*
+}
+
 #
 # Kerberos principals
 # (creat kerberos principals: fred, fred/cgi, fred/mailfilter)
 #
 # Kerberos principals
 # (creat kerberos principals: fred, fred/cgi, fred/mailfilter)
@@ -79,10 +90,6 @@ ID_DAEMON=`pts examine $USER.daemon | head -n1 | sed 's_.*, id: *__' | sed 's_,.
 PATHBITS=`echo $USER | head -c 1`/`echo $USER | head -c 2`/$USER
 HOMEPATH=/afs/hcoop.net/user/$PATHBITS
 MAILPATH=/afs/hcoop.net/common/email/$PATHBITS
 PATHBITS=`echo $USER | head -c 1`/`echo $USER | head -c 2`/$USER
 HOMEPATH=/afs/hcoop.net/user/$PATHBITS
 MAILPATH=/afs/hcoop.net/common/email/$PATHBITS
-DBPATH=/afs/hcoop.net/common/.databases/$PATHBITS
-PGDIR=$DBPATH/postgres
-MYSQLDIR=$DBPATH/mysql
-
 
 #
 # Create LDAP entries. (With the whole libnss-ptdb, I kind of
 
 #
 # Create LDAP entries. (With the whole libnss-ptdb, I kind of
@@ -251,34 +258,8 @@ else
         $HOMEPATH/Maildir
 fi
 
         $HOMEPATH/Maildir
 fi
 
-# DATABASE VOLUME
-if ! vos examine db.$USER >/dev/null 2>/dev/null; then
-  mkdir -p `dirname /afs/.hcoop.net/common/.databases/$PATHBITS`
-  vos create -server afs -partition a -name db.$USER -maxquota 400000
-  fs mkmount -dir /afs/.hcoop.net/common/.databases/$PATHBITS -vol db.$USER -rw
-  fs sa -dir $DBPATH -acl system:postgres l
-  fs sa -dir $DBPATH -acl system:mysql    l
-  fs sa -dir $DBPATH -acl system:backup   rl
-  fs sa -dir $DBPATH -acl $USER           rl
-fi
-
-# Create postgres user and tablespace placeholder within volume
-if ! test -d $PGDIR; then
-  mkdir -p $PGDIR
-  chown postgres:postgres $PGDIR
-  fs sa -dir $PGDIR -acl system:postgres write
-  fs sa -dir $PGDIR -acl $USER           none
-
- sudo -u postgres psql -c "CREATE TABLESPACE user_$USER OWNER postgres LOCATION '$PGDIR'" template1
-fi
-
-# Create mysql user and databases placeholder within volume
-mkdir -p $MYSQLDIR
-chown mysql:mysql $MYSQLDIR
-fs sa -dir $MYSQLDIR -acl system:mysql  write
-fs sa -dir $MYSQLDIR -acl $USER         none
-
-vos release common.databases
+# Create database tablespaces
+execute_on_fritz /afs/hcoop.net/common/etc/scripts/create-user-database $PATHBITS
 
 #
 # Mount points for backup volumes
 
 #
 # Mount points for backup volumes