Files
scripts/Vol-Sync
2020-09-05 17:02:29 +03:00

19 lines
563 B
Bash
Executable File

#!/bin/bash
#Script to sync the Red-Vol when it comes up with the Tui64 share.
INIT_DIR='/Red-Vol'
FINAL_DIR='/rksmb/*'
HOST_IP='192.168.1.66'
#Ping check
ping -c 4 $HOST_IP > /dev/null
#If there is ping, sync the Media and Backups subvolumes.
if [[ $(echo $?) == 0 ]]; then
sshpass -f /shmick/.ssh/sshpasskey rsync -aHAXv --progress --exclude="Torrents" shmick@$HOST_IP:$FINAL_DIR $INIT_DIR
#No DNS resolution
elif [[ $(echo $?) == 2 ]]; then
echo "Could not resolve host."
#No ping
elif [[ $(echo $?) == 1 ]]; then
echo "No communications with host."
fi