root/trunk/bedework/deployment/dumprestore/shellscr/resources/dumpres.sh

Revision 952 (checked in by douglm, 7 years ago)

--

Line 
1 #!/bin/sh
2
3 # Run the bedework dump/restore program
4 # First arg defines the action, dump, restore etc
5 # Second arg should be the filename
6
7 # JAVA_HOME needs to be defined
8
9 cp=@CP@
10
11 DUMPCMD="$JAVA_HOME/bin/java -cp $cp @DUMP-CLASS@"
12 RESTORECMD="$JAVA_HOME/bin/java -cp $cp @RESTORE-CLASS@"
13 SCHEMACMD="$JAVA_HOME/bin/java -cp $cp org.hibernate.tool.hbm2ddl.SchemaExport"
14
15 APPNAME=@BW-APP-NAME@
16
17 case "$1" in
18   dump)
19     echo $DUMPCMD -appname $APPNAME -f $2 $3 $4 $5 $6 $7 $8 $9
20     $DUMPCMD -appname $APPNAME -f $2 $3 $4 $5 $6 $7 $8 $9
21     ;;
22   restore)
23     echo $RESTORECMD -appname $APPNAME -f $2 $3 $4 $5 $6 $7 $8 $9
24     $RESTORECMD -appname $APPNAME -f $2 $3 $4 $5 $6 $7 $8 $9
25     ;;
26   restore-for-quickstart)
27     echo $RESTORECMD -appname $APPNAME -onlyusers "public-user,caladmin,douglm,agrp_*" -f $2 $3 $4 $5 $6 $7 $8 $9
28     $RESTORECMD -appname $APPNAME -onlyusers "public-user,caladmin,douglm,agrp_*" -f $2 $3 $4 $5 $6 $7 $8 $9
29     ;;
30   backup)
31     TARGET=$2/$3`date +%Y%m%d_%H%M%S`.xml
32     echo $DUMPCMD -appname $APPNAME -f $TARGET
33     $DUMPCMD -appname $APPNAME -f $TARGET
34     ;;
35   initdb)
36     echo $RESTORECMD -appname $APPNAME -f ./data/initbedework.xml -initSyspars
37     $RESTORECMD -appname $APPNAME -f ./data/initbedework.xml -initSyspars
38     ;;
39   schema)
40     echo $SCHEMACMD --text --create --config=./classes/hibernate.cfg.xml --output=schema.sql
41     $SCHEMACMD --text --create --config=./classes/hibernate.cfg.xml --output=schema.sql
42     ;;
43   schema-export)
44     echo $SCHEMACMD --create --config=./classes/hibernate.cfg.xml --output=schema.sql
45     $SCHEMACMD --create --config=./classes/hibernate.cfg.xml --output=schema.sql
46     ;;
47   *)
48     echo $"Usage: $0 {dump <filename> |"
49     echo $"           restore <filename> |"
50     echo $"           backup <directory> <prefix>} |"
51     echo $"           initdb |"
52     echo $"           schema |"
53     echo $"           schema-export"
54 esac
55
Note: See TracBrowser for help on using the browser.