NewLiveServer: backup2kiwi

File backup2kiwi, 1.3 KB (added by chris, 6 years ago)
Line 
1#!/bin/bash
2
3# Make sure only root can run our script
4if [ "$(id -u)" != "0" ]; then
5   echo "This script must be run as root" 1>&2
6   exit 1
7fi
8if [[ $HOME != "/root" ]]; then
9   echo "This script must be run as root user not via sudo"  1>&2
10   exit 1
11fi
12
13# backup the mysql databases
14/usr/local/bin/mysql_backup
15
16# scp the latest mysql dump to kiwi
17cd /var/backups/mysql
18scp `ls -t1 *.gz | head -n1` kiwi:quince/var/backups/mysql/
19
20# rsync the wiki
21rsync -av /web/wiki.transitionnetwork.org/www/ kiwi:quince/web/wiki.transitionnetwork.org/www/
22
23# rsync drupal
24rsync -av --exclude=sites/default/files/filecache \
25          --exclude=sites/default/files/css \
26          --exclude=sites/default/files/js \
27          --exclude=sites/default/files/backup_migrate \
28          --exclude=sites/workspaces.transitionnetwork.org/files/filecache \
29          --exclude=sites/workspaces.transitionnetwork.org/files/css \
30          --exclude=sites/workspaces.transitionnetwork.org/files/js \
31  /web/transitionnetwork.org/www/ kiwi:quince/web/transitionnetwork.org/www/
32
33# rsync static server page
34rsync -av /web/quince.transitionnetwork.org/www/ kiwi:quince/web/quince.transitionnetwork.org/www/
35
36# rsync static site
37rsync -av /web/static.transitionnetwork.org/www/ kiwi:quince/web/static.transitionnetwork.org/www/