June 8, 201115 yr Allow me to elaborate with tonight's current issue. It's typical of my troubles no matter what I try to do so any help with this would be appreciated, but a good book or website that would help me in general would be awesome. So I finally got sabNZBD working on unraid. Sweet! It has support for a pre-queue script which I want to use to add movies to my queue paused. I read up a bit on find a forum posting on sab forums about how to make a pre-queue script. It includes the following script... #!/usr/bin/env bash # # NZB set category Script by Mar2zz v0.1 # input (this is what sabnzbd feeds to this script) # All parameters (except 1) can be empty, meaning a default value. # 1 : Name of the NZB (no path, no ".nzb") # 2 : PP (0, 1, 2 or 3) # 3 : Category # 4 : Script (no path) # 5 : Priority (-100, -1, 0 or 1 meaning Default, Low, Normal, High) # 6 : Size of the download (in bytes) # 7 : Group list (separated by spaces) # 8 : Show name # 9 : Season (1..99) # 10 : Episode (1..99) # 11: Episode name # outputparams (what this script tells sabnzbd) # The script writes the results to the console, each parameter on a separate line. # Each parameter (except 1) can be an empty line, meaning the original value. # 1 : 0=Refuse, 1=Accept # 2 : Name of the NZB (no path, no ".nzb") # 3 : PP (0, 1, 2 or 3) # 4 : Category # 5 : Script (basename) # 6 : Priority (-100 -2, -1, 0 or 1, meaning Default, Paused, Low, Normal, High ) # 7 : Group to be used (in case your provider doesn't carry all groups and there are multiple groups in the NZB) ### if a word between *'s is found in the groups the category will be changed to the one that's set. #case $7 in # *movie*) # cat=movies # ;; # *book*) # cat=ebooks # ;; # *teevee*) # cat=tvshows # ;; # *multimedia*) # cat=tvshows # ;; # *) # cat=$3 # ;; #esac case $4 in *movies*) priority=-2 ;; *) priority=$5 ;; esac case $2 in *UFC*) priority=-2 ;; *) priority=$5 ;; esac ### now tell sab what to do with nzb (note, this must be echoed in specific order, every command on a new line) echo "1" # tell sab to use this .nzb echo $1 # keep original name for nzb echo $2 # keep original pp #echo "$cat" #set category to new if one of the parameters was found echo $3 # keep the original category echo $4 # keep the original post-processing script echo "$priority" # set priority to paused if it is a movie or UFC. And then says to save it as a script and then set the executable bit. No clue what the naming convention is for a script but I guessed prequeue.sh, is .sh good for this? Does it even matter? I know in windows it would be a .bat but no idea in unraid. I see a lot of .py but believe that is only for python scripts, not 100% sure though. Then I look for this execute bit. I can't find it in Mac OSX finder. It says read/write which makes me think it's missing execute but I can't see how to set it. Ok, try something else. I go to ajaxexplorer to see if I can set it there in unraid. Can't log in to ajaxexplorer. I try my username and password, various combinations of admin and root, no luck. I hit google up, google ajaxplorer login password, nothing. Anyone know what the default user/pass of this tool is? Is it even the right tool to use? I suppose I should do this from the command line instead? If so I'll have to figure out how to terminal into the unraid box, I just recently switched to mac and only knew how to get into unraid using putty in windows. Basically, besides solving my current problem I am thinking there must be some sort of mindset change I need to make so that every problem doesn't lead me down dead end after dead end. It's not like I'm new to tinkering with OS' but after so many years working with various graphical interfaces or windows command line I am finding the basics that people are just assuming away (like just save it as a script and set the execute bit) are taking me a ton of time anytime I try to make any changes to my config. Any help you guys can provide would be very much appreciated. -Shane
June 8, 201115 yr I'd recommend checking out some basic linux books/sites that walk you through the essential tools to navigate, edit and manipulate files via command line. For what you're trying to do, putty should work fine. #!/usr/bin/env bash ^ This line, known as the shabang, it tells you and your machine what kind of file you're running. In this case it's a bash shell script. You won't need an extension on the filename, but it couldn't hurt so you can tell what language it is written in from the command line. ".sh" would be appropriate. mv prequeue prequeue.sh To determine the permissions of the file navigate into the directory where the script is located: cd /boot/folder/ then do a long list ls -l prequeue.sh On the left there will be a string of what appears to be gibberish, such as "-rw-r--r--" That gibberish is telling you what permissions various entities have for that file. In the example I gave, the "Owner" has read/write permissions, "Group" has read permissions only and "Other" also has read permissions. To change the permissions use chmod. If you can't remember the order of bits, try a chmod calculator and pick the permissions you want. It gives you a 3-digit hex number that signifies what bits are set. For this script I'd give Owner execute permissions and leave read permissions on Group and Other like so: chmod 744 prequeue.sh do a long list again and you should now see "-rwxr--r--" next to prequeue.sh and Owner now has execute permissions
June 8, 201115 yr Author Making some progress. Figured out ls -l shows me the file permissions and I already had rwx set. Looks like the execute bit wasn't the reason the pre-queue script doesn't work. Looked in pkg manager and it says admin/admin is the user/pass for ajaxplorer but it just doesn't work for me.
June 8, 201115 yr Author Thanks for the chmod trick. The results don't quite match up with what you say I should expect though. I started with -rwx------ 1 root root 3013 Jun 7 20:38 prequeue.sh* ran chmod 644 prequeue.sh and then ended up with -rw-r--r-- 1 root root 3013 Jun 7 20:38 prequeue.sh
June 8, 201115 yr Author Getting closer. Turns out TextEdit on a mac isn't really like Notepad in Windows. It was saving my script with rft info hidden inside it, didn't see it until I opened the script in an actual raw text editor.
June 8, 201115 yr Later you'll find this was all a bit like recovering from a bad accident. Every day was painful but look how far you've come! Seriously, do the same stuff again. It's easier. The next discoveries happen with context and so become easier themselves, and so on. Somewhere along the way you'll notice that change in thinking, from someone else's gui representation to your own abstractions.
June 8, 201115 yr Getting closer. Turns out TextEdit on a mac isn't really like Notepad in Windows. It was saving my script with rft info hidden inside it, didn't see it until I opened the script in an actual raw text editor. Text edit can work, though you will need to tell it to "Convert to Plain text" (or something of the like) in one of the menu's. I use TextMate for nearly all my file editing on my Mac and NotePad++ on windows.
Archived
This topic is now archived and is closed to further replies.