Backup: pass bucket name on the command line

This commit is contained in:
2018-07-21 10:20:03 +02:00
parent d85d782b17
commit 5a5aa908b8

View File

@@ -1,5 +1,7 @@
#!/usr/bin/env bash
BUCKET="${1?GCS bucket name is required}"
mkdir -p "$HOME/tmp"
exec >"$HOME/tmp/backup.log" 2>&1
@@ -25,4 +27,4 @@ ROUND="$(($(date +%_j) % 10))"
--exclude=bower_components \
"$HOME" |
gsutil cp - \
"gs://backup-dasfoo-org/$(hostname)/$(whoami)/backup-$ROUND.tar"
"gs://${BUCKET}/$(hostname)/$(whoami)/backup-$ROUND.tar"