Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Server per la connessione
- server="localhost"
- # Utente per la connessione ssh
- user="mirko"
- # Porta per la connessione ssh
- port="22"
- # Opzioni per la sincronizzazione di unison
- # -auto automatically accept default (nonconflicting) actions
- # -group synchronize group attributes
- # -maxerrors n maximum number of errors before a directory transfer is aborted
- # -owner synchronize owner
- # -retry n re-try failed synchronizations N times (text ui only)
- # -times synchronize modification times
- boptions="-auto -group -retry 3 -owner -times"
- # Crea la directory e il file di log
- mkdir -p $HOME/.rsyncremote
- logfile=$HOME/.rsyncremote/"`date +%d%m%y%H%M%S`.log"
- touch $logfile
- chmod 744 $logfile
- #Verifica la disponibilità di unison
- if which unison > /dev/null; then
- # Prova a pingare il server
- ping -c 1 $server 1>/dev/null
- # Se il server è raggiungibile
- if [ $? == "0" ]; then
- #Testa connessione e presenza di unison sul server
- if ssh -p $port $user@$server unison -version > /dev/null; then
- #Sincronizza
- unison dirprova ssh://$user@$server:$port/backup -logfile $logfile -terse $boptions
- fi
- fi
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement