Created
September 7, 2019 17:47
-
-
Save r0mdau/a7e5c60ca02687b743142aed1e0bf408 to your computer and use it in GitHub Desktop.
Rsync backup
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/sh | |
if [ $(mount | grep -c /media/romain/disk) = 1 ] | |
then | |
SOURCE="/home/romain" | |
ACTUEL="/media/romain/disk/raupi/actuel" | |
BACKUP="/media/romain/disk/raupi/$(date +'%Y-%m-%d')" | |
mkdir -p "$BACKUP" | |
/usr/bin/rsync -av --stats --delete --backup --backup-dir="$BACKUP" "$SOURCE" "$ACTUEL" | |
rmdir --ignore-fail-on-non-empty $BACKUP | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment