-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlinode_backup
More file actions
executable file
·27 lines (24 loc) · 866 Bytes
/
linode_backup
File metadata and controls
executable file
·27 lines (24 loc) · 866 Bytes
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
#!/bin/bash
REMOTE_HOST=linode.mattcaron.net
DESTINATION=$HOME/attic/backup/linode
BACKUP_KEY=$HOME/.ssh/id_rsa_backup
# Note that, if you modify this command, you will need to update it in
# /root/.ssh/authorized_keys (on linode) as well.
rsync --rsh="ssh -o ControlMaster=no -i $BACKUP_KEY -l root" \
-Havzh --delete --relative --out-format="" \
$REMOTE_HOST:/etc \
$REMOTE_HOST:/home \
$REMOTE_HOST:/var/lib/matrix-synapse \
$REMOTE_HOST:/var/lib/mysql \
$REMOTE_HOST:/var/lib/postgresql \
$REMOTE_HOST:/var/lib/sympa \
$REMOTE_HOST:/var/spamassassin \
$DESTINATION | \
grep "[[:alnum:]]" | grep -v ^deleting
if [ ${PIPESTATUS[0]} -ne 0 ]; then
echo -n "rsync exited with an error. "
echo "Check above for specific failures."
else
echo -n "rsync reported no errors. "
echo "Check above, in case it's lying."
fi