Skip to content

Instantly share code, notes, and snippets.

@gcoda
Created August 10, 2015 14:57
Show Gist options
  • Save gcoda/d5d153206be2a33d4062 to your computer and use it in GitHub Desktop.
Save gcoda/d5d153206be2a33d4062 to your computer and use it in GitHub Desktop.
Simple backup script
#!/bin/sh
#
# Dropbox got a symlink to my .Private folder.
# Using rsync to be more sure about stuff
# and not to worry about needless dropbox upload
# when no changes to source files were made
#
# Check if got tools
command -v ecryptfs-mount-private >/dev/null 2>&1 || { echo >&2 "ecryptfs-mount-private it's not installed. Aborting."; exit 1; }
command -v rsync >/dev/null 2>&1 || { echo >&2 "rsync it's not installed. Aborting."; exit 1; }
# Simple function to write less, should add var to keep destination path in
b () { mkdir -p ~/Private/Backup/$2 ; rsync -rtuc $1 ~/Private/Backup/$2 ; }
# Mount encripted Private folder first, does nothing if alredy mounted
ecryptfs-mount-private
#
b ~/Projects
# Config Files
b ~/.i3 dotfiles
b ~/.themes dotfiles
b ~/.zshrc dotfiles
b ~/.bashrc dotfiles
b ~/.compton.conf dotfiles
b ~/.vim dotfiles
b ~/.vimrc dotfiles
b ~/.xinitrc dotfiles
b ~/.ttycolors.sh dotfiles
b ~/.config/mpv dotfiles/.config
# Some fonts i am used to
b ~/.local/share/fonts dotfiles/.local/share
# Not even sure why i need this in backups
b /etc/fstab etc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment