1 | #!/bin/bash |
---|
2 | |
---|
3 | # Make sure only root can run our script |
---|
4 | if [ "$(id -u)" != "0" ]; then |
---|
5 | echo "This script must be run as root" 1>&2 |
---|
6 | exit 1 |
---|
7 | fi |
---|
8 | if [[ $HOME != "/root" ]]; then |
---|
9 | echo "This script must be run as root user not via sudo" 1>&2 |
---|
10 | exit 1 |
---|
11 | fi |
---|
12 | |
---|
13 | # backup the mysql databases |
---|
14 | /usr/local/bin/mysql_backup |
---|
15 | |
---|
16 | # scp the latest mysql dump to kiwi |
---|
17 | cd /var/backups/mysql |
---|
18 | scp `ls -t1 *.gz | head -n1` kiwi:quince/var/backups/mysql/ |
---|
19 | |
---|
20 | # rsync the wiki |
---|
21 | rsync -av /web/wiki.transitionnetwork.org/www/ kiwi:quince/web/wiki.transitionnetwork.org/www/ |
---|
22 | |
---|
23 | # rsync drupal |
---|
24 | rsync -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 |
---|
34 | rsync -av /web/quince.transitionnetwork.org/www/ kiwi:quince/web/quince.transitionnetwork.org/www/ |
---|
35 | |
---|
36 | # rsync static site |
---|
37 | rsync -av /web/static.transitionnetwork.org/www/ kiwi:quince/web/static.transitionnetwork.org/www/ |
---|