Hi,
I need your help again. I've made some modifications modifications in my script
in order to send the data of a completed torrent on remote host.
Code: Select all
#!/bin/bash
{
#COMMANDE
RSYNC=/usr/bin/rsync
#DATE
DAY=`date +"%F"`
TIME=`date +"%T"`
#LOGFILE
RSC="/path/to/log/rsync_${DAY}_${TIME}.log"
HST="/path/to/log/history_${DAY}.log"
ERR="/path/to/log//error_${DAY}.log"
#DIRECTORIES AND REMOTE HOST
DATADIR="/path/to/data/"
DHOST="user@remote-host:/media/downloads/"
#TORRENT PATH
PATH="$DATADIR$TR_TORRENT_NAME"
#OR THIS,
#PATH=$(echo "$DATADIR$TR_TORRENT_NAME" | sed 's/ /\\ /g')
#BUT I DON'T KNOW IF IT'S A GOOD IDEA
echo $TIME $TR_TORRENT_NAME >> $HST
echo "Path: "$PATH >> $HST
if [ -e "$PATH" ]; then
if [ -d "$PATH" ] ; then
$RSYNC -ruv $PATH $DHOST >> $RSC 2>> $ERR &
else
$RSYNC -uv $PATH $DHOST >> $RSC 2>> $ERR &
fi;
fi;
} &
The script's running until the first if, then nothing.
So I tried to remove the if tests and just let the rsync command but nothing.
Can someone help me ?
Other thing, rsync via ssh doesn't require a password in this case, because I've setup a private et public key between the two hosts.