Last active
July 14, 2016 15:38
-
-
Save fvigotti/fdd6ebbd7db04627f750ffd9b619bb5d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -xe | |
do_backup(){ | |
rsync -avz --delete-after --exclude='.trashcan' /jhome/ /jbackup/ | |
} | |
while : ; do sleep 300 ; do_backup ; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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