check column existance first (resubmission_date) in update script
[tine20] / scripts / backup / backup-data.sh
1 #!/bin/bash
2
3 BACKUP_PATH=$(mktemp --directory --tmpdir=/tmp/)
4 TODAY=$(date +"%Y-%m-%d")
5
6 if [ ! -x /usr/bin/innobackupex ]; then
7     echo "innobackupex not found exiting"
8     exit 1
9 fi
10
11 if [ ! -x /usr/bin/xtrabackup ]; then
12     echo "xtrabackup not found exiting"
13     exit 1
14 fi
15
16 # MyISAM and Innodb tables
17 innobackupex --defaults-extra-file /etc/tine20/xtrabackup.cnf --no-timestamp $BACKUP_PATH/mysql
18
19 # prepare Innodb tables
20 xtrabackup --prepare --target-dir=$BACKUP_PATH/mysql
21 xtrabackup --prepare --target-dir=$BACKUP_PATH/mysql
22
23
24 (cd $BACKUP_PATH/mysql/ && tar cjf ../full_mysql.tar.bz2 .)
25
26 rm -rf $BACKUP_PATH/mysql
27
28 (cd /var/lib/tine20/files; tar cjf $BACKUP_PATH/tine20_files.tar.bz2 .)
29
30 test -d /var/lib/tine20/backup/$TODAY || mkdir -p /var/lib/tine20/backup/$TODAY
31
32 mv $BACKUP_PATH/full_mysql.tar.bz2 /var/lib/tine20/backup/$TODAY
33 mv $BACKUP_PATH/tine20_files.tar.bz2 /var/lib/tine20/backup/$TODAY
34
35 rm -rf $BACKUP_PATH
36