Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
sudo -u {{ USER }} /home/msl09/custom-scripts/backup-server
#!/bin/sh -e
cd "$HOME"
rm -rf backup/
mkdir -p Dropbox/server-backup/ backup/
rsync -a --exclude="$IGNORE"{/etc,/var/log} backup/
find backup/ -mindepth 1 -type f -mtime +1 -delete # delete files older than a day
find backup/ -type l -delete #delete symbolic links
find backup/ -type d -empty -delete #delete empty dirs
tar -cf "$HOME"/Dropbox/server-backup/"backup-$(date -I).tar.xz" backup/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment