On my QNAP NAS (x86) I have constructed a bash script called rsync.sh which is called by crontab every hour and downloads media into various folders from my seedbox. It then calls another script filebot_bat.sh.
rsync.sh calls it with this line:
Code: Select all
/bin/sh /share/Disk1/filebot_bat.sh /share/Disk4/Download/lowresmovies /share/Disk8/lowresmovies >> /share/Disk1/filebot_call.log
(note that series always go to the same place - where sickrage picks it up later)
Code: Select all
#!/bin/bash
if [ ! -d "${1}" ]; then
printf '%s: error: mandatory argument is not a valid directory.' "${0##*/}" 1>&2
exit 1
fi
echo "$1 $2"
origindir="$1"
echo "$(date +"%T") \"from\" directory is: $origindir"
if [ ! -d "${2}" ];then echo "Unpack Directory is same dir"; unpackdir="$1";
else
unpackdir="$2";echo "unpack dir is $unpackdir"
fi
seriesdir="/share/Download/sickrage"
echo "$(date +"%T") TV output dir is ${seriesdir}";
echo "$(date +"%T") Starting FILEBOT...."
/bin/sh /opt/bin/filebot -script fn:amc ${origindir} --log-file /share/Disk1/filebotnis_run.log --action move -non-strict --output srt "$origindir" --def clean=y subtitles=en deleteAfterExtract=y -non-strict movieFormat="$unpackdir/{fn.length() > folder.name.length() ? fn.upperInitial().space('.').replaceAll(/\.Eng$/,'').replaceAll(/\.En$/,'').replaceAll(/\.en$/,'').replaceAll(/\.En$/,'') : folder.name.upperInitial().space('.')}/{fn.upperInitial().space('.')}" seriesFormat="${seriesdir} {fn.length() > folder.name.length() ? fn.upperInitial().space('.').replaceAll(/\.Eng$/,'').replaceAll(/\.En$/,'').replaceAll(/\.en$/,'').replaceAll(/\.En$/,'') : folder.name.upperInitial().space('.')}/{fn.upperInitial().space('.')}"
echo "$(date +"%T") DONE FILEBOT"
All files get unpacked and put in the right folders. Log files are created so I can follow the execution.
But when rsync.sh is executed by crontab, all downloads work and the logs shows that every line up til and after the filebot_bat.sh script is called. But the script simply does not execute. It does not even create the log file it is supposed to (/share/Disk1/filebotnis_run.log).
Am I doing something completely wrong here? what am I missing?
I changed filebot to /bin/sh /opt/bin/filebot
Code: Select all
[~] # which filebot
/opt/bin/filebot
[~] #
Thanks for any help.
This is killing my automation

I realize I'm noob in scripting - so I'm glad to learn.
//noze2000