Page 1 of 1

Script Logging? Not sure why my script isnt running

Posted: April 4th, 2014, 7:37 pm
by racerx8413
I wrote this basic script to recursively search folders, delete all samples, srv, nfo's, etc,
and move mp4, mkv, avi, srt to a different folder.

I popped the script with +x into the postprocessing folder - told SABNZBD where my postprocessing folder was, and then queued up some items. They finished, the script doesnt appear to run.

The script is called move.sh - is executable, and lives in the /media/postprocessing folder in the sabnzbd jail on FreeNAS.

As you can see, it searches the sabznbd download folder for certain file types, then deletes, or moves them. It works great when run from shell. I guess my question is - how to look at logging to see why it isnt run postprocess, did i do it wrong? I've tried this both ways - using my jails mounted paths, and paths as root, in the script.

The contents of the script are as follows:

Code: Select all

find /mnt/media/Shares/Unsorted/dump/ -name "*sample*" -type f -exec rm -rf {} \;
find /mnt/media/Shares/Unsorted/dump/ -iname "*.nzb" -type f -exec rm -rf {} \;
find /mnt/media/Shares/Unsorted/dump/ -iname "*.nfo" -type f -exec rm -rf {} \;
find /mnt/media/Shares/Unsorted/dump/ -iname "*.sfv" -type f -exec rm -rf {} \;
find /mnt/media/Shares/Unsorted/dump/ -iname "*.srr" -type f -exec rm -rf {} \;
find /mnt/media/Shares/Unsorted/dump/ -iname "*.db" -type f -exec rm -rf {} \;
find /mnt/media/Shares/Unsorted/dump/ -iname "*.jpg" -type f -exec rm -rf {} \;


find /mnt/media/Shares/Unsorted/dump/ -iname "*.mkv" -type f -exec mv {} /mnt/media/Shares/Unsorted/ \;
find /mnt/media/Shares/Unsorted/dump/ -iname "*.mp4" -type f -exec mv {} /mnt/media/Shares/Unsorted/ \;
find /mnt/media/Shares/Unsorted/dump/ -iname "*.srt" -type f -exec mv {} /mnt/media/Shares/Unsorted/ \;
find /mnt/media/Shares/Unsorted/dump/ -iname "*.avi" -type f -exec mv {} /mnt/media/Shares/Unsorted/ \;

Re: Script Logging? Not sure why my script isnt running

Posted: April 5th, 2014, 2:28 am
by sander
I would start by putting logging at the begin and the end of the script. Something like

echo starting... `date` >> /tmp/myscript.log
...
echo finished... `date` >> /tmp/myscript.log

Re: Script Logging? Not sure why my script isnt running

Posted: April 5th, 2014, 11:44 am
by racerx8413
Throwing a >> to a log file shows that it's not actually doing anything at all -the .sh script doesn't get run.
Are there any other configurations I might be missing to enable them? I assume I just drop any .sh into the postprocessing folder, and they run?

Re: Script Logging? Not sure why my script isnt running

Posted: April 5th, 2014, 12:39 pm
by sander
racerx8413 wrote:I assume I just drop any .sh into the postprocessing folder, and they run?
No, when you add a NZB you have to select the script that has to be run

Re: Script Logging? Not sure why my script isnt running

Posted: April 5th, 2014, 3:49 pm
by racerx8413
oh well poo, guess i totally misinterpreted that. I'll just write a cron,