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

Revision 1497 (checked in by douglm, 6 years ago)

Fix tag so that user cal works again

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=.:./classes:./resources
10
11 for i in lib/*
12   do
13     cp=$cp:$i
14 done
15
16 # Need a temp dir for hibernate cache
17 TEMPDIR="./temp"
18 mkdir $TEMPDIR
19
20 DUMPCMD="$JAVA_HOME/bin/java -Djava.io.tmpdir="$TEMPDIR" -cp $cp @DUMP-CLASS@"
21 RESTORECMD="$JAVA_HOME/bin/java -Djava.io.tmpdir="$TEMPDIR" -cp $cp @RESTORE-CLASS@"
22 SCHEMACMD="$JAVA_HOME/bin/java -Djava.io.tmpdir="$TEMPDIR" -cp $cp org.hibernate.tool.hbm2ddl.SchemaExport"
23
24 APPNAME=@BW-APP-NAME@
25
26
27 case "$1" in
28   dump)
29     echo $DUMPCMD -appname $APPNAME -f $2 $3 $4 $5 $6 $7 $8 $9
30     $DUMPCMD -appname $APPNAME -f $2 $3 $4 $5 $6 $7 $8 $9
31     ;;
32   restore)
33     echo $RESTORECMD -appname $APPNAME -f $2 $3 $4 $5 $6 $7 $8 $9
34     $RESTORECMD -appname $APPNAME -f $2 $3 $4 $5 $6 $7 $8 $9
35     ;;
36   restore-for-quickstart)
37     echo $RESTORECMD -appname $APPNAME -onlyusers "public-user,caladmin,douglm,agrp_*" -f $2 $3 $4 $5 $6 $7 $8 $9
38     $RESTORECMD -appname $APPNAME -onlyusers "public-user,caladmin,douglm,agrp_*" -f $2 $3 $4 $5 $6 $7 $8 $9
39     ;;
40   backup)
41     TARGET=$2/$3`date +%Y%m%d_%H%M%S`.xml
42     echo $DUMPCMD -appname $APPNAME -f $TARGET
43     $DUMPCMD -appname $APPNAME -f $TARGET
44     ;;
45   initdb)
46     echo $RESTORECMD -appname $APPNAME -f ./data/initbedework.xml -initSyspars $2 $3 $4 $5 $6 $7 $8 $9
47     $RESTORECMD -appname $APPNAME -f ./data/initbedework.xml -initSyspars $2 $3 $4 $5 $6 $7 $8 $9
48     ;;
49   drop)
50     echo $SCHEMACMD --text --drop --format --delimiter="@SCHEMA-DELIMITER@" --config=./classes/hibernate.cfg.xml --output=schema.sql
51     $SCHEMACMD --text --drop --format --delimiter="@SCHEMA-DELIMITER@" --config=./classes/hibernate.cfg.xml --output=schema.sql
52     ;;
53   drop-export)
54     echo $SCHEMACMD --drop --format --delimiter="@SCHEMA-DELIMITER@" --config=./classes/hibernate.cfg.xml --output=schema.sql $2 $3 $4 $5 $6 $7 $8 $9
55     $SCHEMACMD --drop --format --delimiter="@SCHEMA-DELIMITER@" --config=./classes/hibernate.cfg.xml --output=schema.sql $2 $3 $4 $5 $6 $7 $8 $9
56     ;;
57   schema)
58     echo $SCHEMACMD --text --create --format --delimiter="@SCHEMA-DELIMITER@" --config=./classes/hibernate.cfg.xml --output=schema.sql
59     $SCHEMACMD --text --create --format --delimiter="@SCHEMA-DELIMITER@" --config=./classes/hibernate.cfg.xml --output=schema.sql
60     ;;
61   schema-export)
62     echo $SCHEMACMD --create --format --delimiter="@SCHEMA-DELIMITER@" --config=./classes/hibernate.cfg.xml --output=schema.sql $2 $3 $4 $5 $6 $7 $8 $9
63     $SCHEMACMD --create --format --delimiter="@SCHEMA-DELIMITER@" --config=./classes/hibernate.cfg.xml --output=schema.sql $2 $3 $4 $5 $6 $7 $8 $9
64     ;;
65   *)
66     echo $" "
67     echo $"Usage: "
68     echo $"  $0 dump <filename> [-ndebug] "
69     echo $"     Dump the database in xml format suitable for restore."
70     echo $" "
71     echo $"  $0 restore <filename> [-ndebug]"
72     echo $"     Restore the database from an xml formatted dump."
73     echo $" "
74     echo $"  $0 backup <directory> <prefix>} "
75     echo $"     Dump the database in xml format suitable for restore."
76     echo $"     Files will have a name built from the prefix and the current date/time."
77     echo $" "
78     echo $"  $0 initdb [ -ndebug] [-indexroot=<lucene-index-root>"
79     echo $"     Populate the database using the provided initial data."
80     echo $" "
81     echo $"  $0 drop [--haltonerror] "
82     echo $"     Create a file in the current directory with sql drop statements"
83     echo $" "
84     echo $"  $0 drop-export [--haltonerror]"
85     echo $"     Drop tables in the database. Note this may not work if the schema"
86     echo $"     was changed."
87     echo $" "
88     echo $"  $0 schema [--haltonerror] "
89     echo $"     Create a schema from the xml schema. Placed in a file in the current directory"
90     echo $" "
91     echo $"  $0 schema-export [--haltonerror]"
92     echo $"     Create a schema from the xml schema."
93     echo $"     Also create the database tables, indexes etc."
94     echo $" "
95 esac
96
Note: See TracBrowser for help on using the browser.