Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #please edit folder paths to fill your needs
- origin="/home/luca/"
- destination="/media/luca/MYDISK/backup-luca/"
- mountpoint="/media/luca/MYDISK"
- if pgrep "rsync" > /dev/null
- then
- echo "There is already rsync running"
- exit 0
- fi
- if [ ! -d "$destination" ]; then
- #your password is stored without encryption. This is not safe.
- echo "lamiapassword" | sshfs utente@server.lan:/ "$mountpoint" -o password_stdin
- fi
- if [ -d "$destination" ]; then
- rsync -avr --progress --delete --no-perms --omit-dir-times "$origin" "$destination"
- dpkg --get-selections > "$destination/pacchetti_installati.txt"
- umount "$mountpoint"
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement