The script basically cleans up any junk usenet files and removes a serial number that gets placed on the end of every nzb on an indexer I use. The serial number always starts with a _[#number] but sometimes doesn't have the "_" so I made a "_" or a "[" as the post removal trigger as no nzbs i download from this site has those characters. It did the job great when manually testing nzbs from main page. They get moved to that directory with the serial tag removed and release intact. As soon as I then run it in a rss post script, my sabnzbd implodes. The last 3 lines of code is the only thing new with this script then the others I run. The conflict with sabnzbd must be in that part of the script. (but it is deleting files from config too, which means the find statement is being applied to config too.) I'm really stumped by this.
I run the 'linuxserver' docker version of sabnzbd out of an unraid server. (forum wouldn't let me link the docker page)
Thanks for any help.
Code: Select all
#!/bin/bash
cd ~ && cd $1
find . -type f | grep -v '.r\|.mkv\|.jpg\|.nfo\|.sfv' | xargs rm
relpath=$(pwd)
relname=`basename "$relpath" | cut -f1 -d"_" | cut -f1 -d"["`
mv $relpath `echo /mnt/user/Main.Share/NZB/$relname`