
I believe the issue is the manner in which sabnzbd is calling my script. I have a category called "Games", and have the script Games.sh associated with that category. From my Sab logs I see that my script is firing off like this:
Code: Select all
/usr/local/src/sabnzbd/scripts/Games.sh(/mnt/disk2/Downloads/Complete/Games/Nurarihyon No Mago Hyakki Ryouran Taisen JPN XBOX360 SuperX360, Nurarihyon No Mago Hyakki Ryouran Taisen JPN XBOX360 SuperX360.nzb, Nurarihyon No Mago Hyakki Ryouran Taisen JPN XBOX360 SuperX360, , games, alt.binaries.games.xbox360, 0)
When I try this same command via a terminal I get the same error every time: "syntax error near unexpected token" followed by the first argument that contains a space. So like the above line gets the results:
Code: Select all
-bash: syntax error near unexpected token `/mnt/disk2/Downloads/Complete/Games/Nurarihyon'

Here's the full text of my shell script so far:
Code: Select all
#!/bin/bash
clear
echo "1 is $1"
###############
# Settings #
###############
#
# 360 Settings
#
################
Extract360ISO="Yes"
Delete360ISO="Yes"
Move360ISO="No"
Extract360Destination="/mnt/disk3/Games/Xbox360/Games/"
ISODestination360="/mnt/disk3/Games/Xbox360/ISO/"
DLCDestination360="/mnt/disk3/Games/Xbox360/DLC/"
##################
#
#Wii Settings####
#
#################
WiiExtractISO="Yes"
WiiDeleteISO="Yes"
WiiExtractDestination="/mnt/disk3/Games/Wii/Games/"
WiiISODestination="/mnt/disk3/Games/Wii/ISO/"
#
#
if [ $7 = "0" ];
then
if [ $1 = *XBOX360* ];
echo "Xbox 360 game found."
then
#prepare the release's "pretty name"
# First we grab the release name from SABnzbd
prettyname=$3
# Next we replace all dots with spaces
prettyname=$(echo ${prettyname//./ })
# Then we do the same with underscores
prettyname=$(echo ${prettyname//_/ })
# Chop off the "Xbox360" and release group
#prettyname=$(echo ${prettyname:0:$index})
prettyname=${prettyname% XBOX360*}
echo "Finished release name is $prettyname."
echo "Looking for ISOs."
ISOCount="0"
#move into the directory where the job is
cd "$1"
# find the number of ISOs in the folder
ISOCount=$( ls -1 | grep .iso | wc -l )
# if there's more than 1 ISO we will process it as a multi-disc release
if [ $ISOCount -gt 1 ];
then
ISOCountx="1"
echo "Multi-disc release found."
for f in *.iso;
do
if [ $Extract360ISO = "Yes" ];
then
echo "Extracting $f to $Extract360Destination$prettyname-Disc $ISOCountx";
extract-xiso -x "$f" -d "$Extract360Destination$prettyname-Disc $ISOCountx";
fi
if [ $Move360ISO = "Yes" ];
then
echo "Moving $f to $ISODestination360$prettyname-Disc $ISOCountx.iso";
mv "$f" "$ISODestination360$prettyname-Disc $ISOCountx.iso";
fi
if [[ $Delete360ISO = "Yes" && $Move360ISO = "No" ]];
then
echo "Deleting $f";
rm -f "$f";
fi
ISOCountx=`expr $ISOCountx + 1`;
done
fi
if [ $ISOCount = "1" ];
then
# if its just one ISO we can process it withou the ISOCount stuff
echo "Single disc release found."
if [ $Extract360ISO = "Yes" ];
then
echo "Extracting $f to $Extract360Destination$prettyname";
extract-xiso -x "$f" -d "$Extract360Destination$prettyname";
fi
if [ $Move360ISO = "Yes" ];
then
echo "Moving $f to $ISODestination360$prettyname.iso";
mv "$f" "$ISODestination360$prettyname.iso";
fi
if [[ $Delete360ISO = "Yes" && $Move360ISO = "No" ]];
then
echo "Deleting $f";
rm -f "$f"
fi
fi
if [ $ISOCount = "0" ];
then
# if no ISOs are found maybe its DLC?
echo "No ISOs found, DLC?"
fi
fi
#End Xbox 360 branch
else
echo "Job didn't complete successfully?"
fi
Any suggestions?