Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- HDD="/media/$USER/Data/backup/$HOSTNAME/"
- if [ $# != 1 ]; then
- echo -e "\nErreur : nombre d'agrgument incorrect\n"
- exit 1
- fi
- # Mode Sauvegarde
- if [ $1 == "-b" ] && [ -d $HDD ]; then
- SRC="$HOME"
- DEST="$HDD"
- # Mode Restauration
- elif [ $1 == "-r" ] && [ -d $HDD ]; then
- DEST="$HOME"
- SRC="$HDD/$USER/"
- else
- echo -e "\nErreur\n"
- exit 1
- fi
- rsync --recursive --size-only --links --times --progress --human-readable --exclude ".*" --exclude "Virtual*" --exclude "*~" --log-file=$DEST/backup-`date +%Y-%m-%d-%H-%M-%S`.log $SRC $DEST
- echo -e "\nEnd\n"
Advertisement
Add Comment
Please, Sign In to add comment