Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
# Moves the current installation to a backup folder.
BASE=`dirname "$0"`
if [ ${BASE#/} == ${BASE} ]; then
BASE="`pwd`/${BASE}"
fi
BACKUP_DIR=$1
if [ "$BACKUP_DIR" == "" ]; then
echo ERROR: directory in which configuration should be stored has not been specified!
exit 1
fi
source $BASE/env
$BASE/alldown.sh
ROOT_DIR=$BASE/../servers
CONFIG=$BACKUP_DIR/config-backup
echo "Creating backup folder $BACKUP_DIR ..."
mkdir -p $CONFIG
$BASE/backup-config.sh $CONFIG
OLD_BIS=$BACKUP_DIR/openBIS-server
echo "Copying old installation to backup dir"
echo "mv $ROOT_DIR/openBIS-server $OLD_BIS"
mv $ROOT_DIR/openBIS-server $OLD_BIS
echo "mv $ROOT_DIR/datastore_server $BACKUP_DIR/datastore_server"
mv $ROOT_DIR/datastore_server $BACKUP_DIR/datastore_server
# Note: to restore the database afterwards one can use:
# pg_restore -d db-name db-file.dmp
echo "Creating database dumps for $OPENBIS_DB and $IMAGING_DB..."
echo "$PG_DUMP -U $DB_USER_NAME -Fc $OPENBIS_DB > $BACKUP_DIR/$OPENBIS_DB.dmp"
$PG_DUMP -U $DB_USER_NAME -Fc $OPENBIS_DB > $BACKUP_DIR/$OPENBIS_DB.dmp
echo "DONE"