I have a script that automatically copy and paste finished torrent download files into a different folder. It has been running fine for past few years but for some reason deluge no longer run it after it finished download in the past week, is there some new change with deluge that im not aware of or is my script faulty? Can you guys take a look?
Code: Select all
#!/bin/bash
torrentId=$1
torrentName=$2
torrentPath=$3
currentDate=`date`
destDir="/home22/naginagi/downloads/to-sync"
tempDir="/home22/naginagi/downloads/temp"
label=$(basename "${torrentPath}")
srcPath="${torrentPath}/${torrentName}"
destPath="${destDir}/${label}/${torrentName}"
destParentPath=$(dirname "${destPath}")
if [ ! "${label}" == "uncategorized" ]
then
if [ -d "${srcPath}" ]
then
destTempPath="${tempDir}/${torrentName}"
mkdir -p "${tempDir}"
cp -al "${srcPath}/" "${tempDir}"
find "${destTempPath}/" -name '*.rar' -execdir unrar x {} \;
find "${destTempPath}/" -name '*.r??' -exec rm {} \;
mkdir -p "${destParentPath}"
mv "${destTempPath}" "${destParentPath}"
rm -rf "${destTempPath}"
else
destTempPath=$(echo "${tempDir}/${torrentName}" | sed -e 's/\.[^.]*$//')
mkdir -p "${destTempPath}"
cp -al "${srcPath}" "${destTempPath}"
find "${destTempPath}/" -name '*.rar' -execdir unrar x {} \;
find "${destTempPath}/" -name '*.r??' -exec rm {} \;
mkdir -p "${destParentPath}"
mv "${destTempPath}/"* "${destParentPath}"
rm -rf "${destTempPath}"
fi
echo "date:${currentDate} - \"${torrentName}\" in \"${srcPath}\" linked to \"${destPath}\" label=${label}" >> /home22/naginagi/scripts/link.log
fi