Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/sh
sudo -u {{ USER }} /home/msl09/custom-scripts/backup-server
#!/bin/sh -e
cd "$HOME"
rm -rf backup/
mkdir -p Dropbox/server-backup/ backup/
IGNORE="journal"
rsync -a --exclude="$IGNORE" msl09.com.br:{/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
You can’t perform that action at this time.