summaryrefslogtreecommitdiff
path: root/backup-www
diff options
context:
space:
mode:
Diffstat (limited to 'backup-www')
-rwxr-xr-xbackup-www21
1 files changed, 21 insertions, 0 deletions
diff --git a/backup-www b/backup-www
new file mode 100755
index 0000000..440a060
--- /dev/null
+++ b/backup-www
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+set -e
+
+die() {
+ echo $1 >&2
+ exit 1
+}
+
+# File contains key variable definition.
+. "$HOME/.backup-www"
+[[ -z "$key" ]] && die 'No $key definition.'
+
+name="backup-$(date --rfc-3339=seconds | cut -c -19 | tr ': ' '-_').des3"
+
+sudo find /etc /home/anton /var/www ! -name 'backup-*.des3' -print0 |\
+ sudo cpio --create --dot --null |\
+ openssl enc -des3 -k "$key" > "$name"
+sha512sum "$name" > "$name.sha512sum"
+scp "$name"* gd.bobov.name:
+echo "File name: $name"