Skip to content

Instantly share code, notes, and snippets.

@sixtyfive
Created November 23, 2018 14:10
Show Gist options
  • Save sixtyfive/eac94b9fb4d68b65083421e4df1f8536 to your computer and use it in GitHub Desktop.
Save sixtyfive/eac94b9fb4d68b65083421e4df1f8536 to your computer and use it in GitHub Desktop.
Simple backup script
#!/bin/bash
LOCS="/a /couple /of /paths"
DEST="/some/path"
HOST="user@host" # assuming pubkey auth
AORB="$((`date +%m` % 2))"
[[ $AORB = 1 ]] && AORB="a" || AORB="b"
set -x
tar czf - $LOCS | ssh $HOST "cat > $DEST/backup-$AORB.tar.gz"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment