Skip to content

Instantly share code, notes, and snippets.

@GitHub30
Created September 3, 2016 07:29
Show Gist options
  • Save GitHub30/2a8e119be176a7660bf40e024d1e1d23 to your computer and use it in GitHub Desktop.
Save GitHub30/2a8e119be176a7660bf40e024d1e1d23 to your computer and use it in GitHub Desktop.
Backup script
#!/bin/bash
# Usage:
# bash backup.sh
# or
# chmod u+x backup.sh
# ./backup.sh
now=$(date +%Y%m%dT%H%M%S%Z)
filename=$now.tar.bz2
cd
# Make backup directory if it does not exist.
mkdir -p backup
tar jcf backup/$filename --exclude ./backup .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment