Skip to content

Instantly share code, notes, and snippets.

@fvigotti
Last active July 14, 2016 15:38
Show Gist options
  • Save fvigotti/fdd6ebbd7db04627f750ffd9b619bb5d to your computer and use it in GitHub Desktop.
Save fvigotti/fdd6ebbd7db04627f750ffd9b619bb5d to your computer and use it in GitHub Desktop.
#!/bin/bash
set -xe
do_backup(){
rsync -avz --delete-after --exclude='.trashcan' /jhome/ /jbackup/
}
while : ; do sleep 300 ; do_backup ; done
#!/bin/bash
set -xe
# change dir permission
chown 1000 /jhome
[[ $(du -sB 1 /jhome | awk '{print $1}' ) -gt 10000 ]] || { # recover backup
rsync -avz --delete-after --exclude='.trashcan' /jbackup/ /jhome/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment