summaryrefslogtreecommitdiff
path: root/baserock_backup/backup.sh
blob: a65b1445c90f52f199407350f2b869f9fa7a629e (plain)
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
#!/bin/sh

# These aren't normal invocations of rsync: the targets use the
# 'command' option in /root/.ssh/authorized_keys to force execution of
# the 'backup-snapshot' script at the remote end, which then starts the
# rsync server process. So the backup SSH key can only be used to make
# backups, nothing more.

# Don't make the mistake of trying to run this from a systemd unit. There is
# some brokenness in systemd that causes the SSH connection forwarding to not
# work, so you will not be able to connect to the remote machines.

# Database
/usr/bin/rsync --archive --delete-before --delete-excluded \
    --hard-links --human-readable --progress --sparse \
    root@192.168.222.146: /srv/backup/database \
  && date > /srv/backup/database.timestamp

# Gerrit
/usr/bin/rsync --archive --delete-before --delete-excluded \
    --hard-links --human-readable --progress --sparse \
    --exclude='cache/' --exclude='tmp/' \
    root@192.168.222.69: /srv/backup/gerrit \
  && date > /srv/backup/gerrit.timestamp

# FIXME: Storyboard database is not currently backed up, see:
# <https://storyboard.baserock.org/#!/story/74>.