123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- #! /bin/bash
- function backup {
- if mount | grep "on $2 type" > /dev/null
- then
- sudo rsync -av --delete-before /home $3
- sudo rsync -av --delete-before /etc $3
- sudo rsync -av --delete-before /var $3
- sudo rsync -av --delete-before \
- --exclude=Téléchargements \
- --exclude=Steam \
- --exclude=.atom \
- --exclude=Dropbox \
- --exclude=Musique/banshee-playlists \
- /mnt/Data $3
- else
- echo "$1 is not mounted"
- fi
- }
- if [ "$1" = "qnap" ]; then
- if mount | grep "on /mnt/Qnap/bachir type" > /dev/null
- then
- sudo rsync -av --delete-before /home /mnt/Qnap/bachir/bach_backups
- sudo rsync -av --delete-before /etc /mnt/Qnap/bachir/bach_backups
- sudo rsync -av --delete-before /var /mnt/Qnap/bachir/bach_backups
- sudo rsync -av --delete-before \
- --exclude=Téléchargements \
- --exclude=Steam \
- --exclude=.atom \
- --exclude=Dropbox \
- --exclude=Musique/banshee-playlists \
- /mnt/Data /mnt/Qnap/bachir/bach_backups
- else
- echo "Qnap/bachir is not mounted"
- fi
- elif [ "$1" = "extdata" ]; then
- if mount | grep "on /mnt/ExtData type" > /dev/null
- then
- sudo rsync -av --delete-before /home /mnt/ExtData/
- sudo rsync -av --delete-before /etc /mnt/ExtData/
- sudo rsync -av --delete-before /var /mnt/ExtData/
- sudo rsync -av --delete-before \
- --exclude=Téléchargements \
- --exclude=Steam \
- --exclude=.atom \
- --exclude=Dropbox \
- --exclude=Musique/banshee-playlists \
- /mnt/Data /mnt/ExtData/
- else
- echo "ExtData is not mounted"
- fi
- elif [ "$1" = "raidbox" ]; then
- backup "RaidBox" "/mnt/RaidBox" "/mnt/RaidBox/backup/"
- #if mount | grep "on /mnt/RaidBox type" > /dev/null
- #then
- # sudo rsync -av --delete-before /home /mnt/RaidBox/
- # sudo rsync -av --delete-before /etc /mnt/RaidBox/
- # sudo rsync -av --delete-before /var /mnt/RaidBox/
- # sudo rsync -av --delete-before \
- # --exclude=Téléchargements \
- # --exclude=Steam \
- # --exclude=.atom \
- # --exclude=Dropbox \
- # --exclude=Musique/banshee-playlists \
- # /mnt/Data /mnt/RaidBox/
- #else
- # echo "RaidBox is not mounted"
- #fi
- else
- echo "please choose a backup destination : qnap or extdata or raidbox"
- echo "don't forget to mount the destination before launching this script"
- fi
|