diff options
author | root <root@vps-18a7a2b7.vps.ovh.ca> | 2023-04-13 18:49:04 -0400 |
---|---|---|
committer | root <root@vps-18a7a2b7.vps.ovh.ca> | 2023-04-13 18:49:04 -0400 |
commit | ad0f80e4850bf0ba25db234e85b4d37c2c713150 (patch) | |
tree | 2942d37c704f3c054e0f797d654cb78df36f14d2 /other/backup-site.sh | |
parent | d29e7f661ae2c8f761035e691b9b6d9f535b9e9d (diff) |
other hosting stuff
Diffstat (limited to 'other/backup-site.sh')
-rwxr-xr-x | other/backup-site.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/other/backup-site.sh b/other/backup-site.sh new file mode 100755 index 0000000..4f4465a --- /dev/null +++ b/other/backup-site.sh | |||
@@ -0,0 +1,17 @@ | |||
1 | #!/bin/sh | ||
2 | hostname=$(hostname) | ||
3 | r=0 | ||
4 | if LOGFILE=$(mktemp) | ||
5 | then | ||
6 | exec 3>&2 | ||
7 | exec 2>"$LOGFILE" | ||
8 | fi | ||
9 | set -x | ||
10 | rsync -aRi --delete --partial /./srv/*/public_html rsync.net:"$hostname"/ >/dev/null || r=2 | ||
11 | mysqldump --all-databases | gzip -c | ssh rsync.net dd of="$hostname".sql || r=$((r+1)) | ||
12 | if [ "$r" != 0 ] | ||
13 | then | ||
14 | cat "$LOGFILE" >&3 | ||
15 | fi | ||
16 | rm -f "$LOGFILE" | ||
17 | exit $r | ||