Script Logging? Not sure why my script isnt running

Come up with a useful post-processing script? Share it here!
Post Reply
racerx8413
Newbie
Newbie
Posts: 3
Joined: April 4th, 2014, 7:11 pm

Script Logging? Not sure why my script isnt running

Post 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/ \;
User avatar
sander
Release Testers
Release Testers
Posts: 9261
Joined: January 22nd, 2008, 2:22 pm

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

Post 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
racerx8413
Newbie
Newbie
Posts: 3
Joined: April 4th, 2014, 7:11 pm

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

Post 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?
User avatar
sander
Release Testers
Release Testers
Posts: 9261
Joined: January 22nd, 2008, 2:22 pm

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

Post 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
racerx8413
Newbie
Newbie
Posts: 3
Joined: April 4th, 2014, 7:11 pm

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

Post by racerx8413 »

oh well poo, guess i totally misinterpreted that. I'll just write a cron,
Post Reply