This trick can help you to save data over your network.
- first create a ssh certificate on both computers ( server (nas) + your computer )
- export it to the the server
- Run the small script below
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
#!/bin/bash #directory to backup BDIR=~noktec/Desktop/ #Destination IP IP=192.168.80.246 #destination DDIR=/home/noktec #UserName UN=noktec if [ -z $1 ] then echo "use up/down for arg1" else if [ $1 = "down" ] then # ssh connexion receive rsync -avz -e ssh $UN@$IP:$DDIR $BDIR elif [ $1 = "up" ] then #ssh upload rsync -avz -e ssh $BDIR $UN@$IP:$DDIR else echo "use up/down for arg1" fi fi |
To run the script, use the right arguments :
1 2 |
server # script.sh down server # script.sh up |
And that’s it.
Post a Comment