Jump to content

zacharyd3

Members
  • Posts

    20
  • Joined

Posts posted by zacharyd3

  1. 7 minutes ago, fluisterben said:

    I know quite wel how to write cron jobs, it's just completely unclear what to put in the textform on the User scripts page. Or what the scheduled times are as set in the dropdown.

    You put your cron setup in the text box. As for the scheduled times, you can get a plugin to set the "Daily" time yourself. I'm at work at the moment so I can't remember what it's called but I'm pretty sure it's a dynamix plugin and then you get a new settings page under the scheduler to adjust it. I've got my "daily" tasks setup to run at 6:30pm everyday and it work flawlessly.

     

    Edit: Yup it's dynamix that has the scheduler

     

    • Like 1
  2. 3 minutes ago, fluisterben said:

    The 'Schedule' exact times used by User scripts, where do I set and find them?

    Are they simply crontab tasks of the unraid slackware, or what?

    I would like 'Daily' to be Nightly at 5:45 CET. And yes, I see there's a 'corntab' option (it's actually spelled wrong there) but totally unclear what the syntax is.

    Checkout this link to easily use cron:

     

    https://crontab.guru/

     

    Edit: This is what you would want to use if you want it to run everynight at 5:45am: 45 5 * * *

  3. 23 minutes ago, IamSpartacus said:

     

    I've tested this with handbrake.  Say the following file/folder exists:

     

    
    /mnt/cache/Media/TV/The Daily Show/Season 24/The Daily Show - S24E86 - Bernie Sanders.mkv

     

    Then handbrake will output the converted file to:

     

    
    /mnt/user/DownloadsPP/TV/The Daily Show/Season 24/The Daily Show - S24E86 - Bernie Sanders.mkv

     

    And the same with movies, it will match the exact folder structure.  So all I need is a script that will watch the /mnt/user/DownloadsPP/TV and /mnt/user/DownloadsPP/Movies directories and move the entire folder structure underneath into /mnt/cache/Media/ or /mnt/use/Media/

    Actually, Disregard the code I just sent, you can actually take out one line for the media variable, as I never ended up needing it, haha.

     

    This should work just fine:

     

    #!/bin/bash
    debug=1																		#Change this to 1 for more logging, 0 for less
    
    #Start with a clear screen
    clear
    
    #Set working directories
    output=/mnt/user/DownloadsPP/											#Change this to your handbrake output directory
    movies=/mnt/cache/Media/Movies/											#This should be your movies directory
    series=/mnt/cache/Media/TV/												#This should be your series directory
    
    #Search the output directory for new media
    find $output -type f | while read file
    do
    	#Parse the movie name from the filename
    	movieParsed0=$(echo "$file" | cut -d'.' -f1)
    	movieParsed1=$(echo "$movieParsed0" | cut -d'/' -f7) 						#Lower or raise the number in f9 until "Movie parsed to:" shows just the movie name.
    	
    	if [ $debug -eq "1" ]
    	then
    		echo "Full filename: "$file	
    	fi
    	
    	#Check if the file is a movie
    	movieFolder=$movies$movieParsed1
    		
    	if [ -d "${movieFolder}" ]
    	then	
    		if [ $debug -eq "1" ]
    		then
    			echo "Movie parsed to: "$movieParsed1
    			echo "Movie Folder: "$movieFolder
    		fi
    		#Move any found files
    		#mv "${file}" "${movieFolder}"; echo $movieParsed1" Moved"				#Once all the outputs look correct, remove the "#"
    		
    	else
    		seriesParsed0=$(echo "$file" | cut -d'.' -f1)
    		seriesParsed1=$(echo "$seriesParsed0" | cut -d'/' -f6)					#Lower or raise the number in f8 until "Series parsed to:" shows just the movie name.
    		seasonParsed0=$(echo "$seriesParsed0" | cut -d'/' -f7)					#Change f9 to one higher than  the previous line
    		episodeParsed0=$(echo "$seriesParsed0" | cut -d'/' -f8)				#Change f10 to one higher than  the previous line
    		seriesFull=$series$seriesParsed1/$seasonParsed0
    		
    		if [ -d "${seriesFull}" ]
    		then	
    			if [ $debug -eq "1" ]
    			then
    				echo "Series parsed to: "$seriesParsed1
    				echo "Season parsed to: "$seasonParsed0
    				echo "Series Folder: "$seriesFull
    			fi
    			#mv "${file}" "${seriesFull}"; echo $seriesParsed1" Moved"			#Once all the outputs look correct, remove the "#"
    		fi		
    	fi
    	echo ""
    done

     

    • Like 1
  4. 1 hour ago, IamSpartacus said:

     

    Thanks.

     

    I'm thinking all I really need is a simple script now that watches two folders.  Something like:

     

    If file exists in /downloadsPP/movies/Movie_Title, move to /mnt/cache/media/movies/Movie_Title/

    if file exists in /downloadsPP/series, moves to /mnt/cache/media/TV/Series/

    Yea if you can get it to include the folders then it should be really easy to setup. If you can get handbrake to output the files into the original folder structure like you're saying you can easily get it to copy them back by just changing the "/downloads/" to "mnt/cache/media/" It's a tad busy at work rn but if I don't have time to set it up, I'll get a rough draft setup tonight and send it your way.

  5. 11 hours ago, IamSpartacus said:

     

    First off I appreciate your assistance with working this out with me, so thank you 👍.

     

    Yes my tv directory is setup like you have it and for movies it's /mnt/cache/Media/Movies/The Dark Knight/The Dark Knight.mkv.  I can output the files back to the Sonarr and Radarr directories but how would I signal to either of them to import the files since they've already done so?

    Ok, so this should work specifically for movies, TV will still need some work. The only issue I see coming up is if there is a TV show episode that has a title that matches a movie name, however if your shows are stored like "/Shameless/Season 1/S01E01 - show title.mkv" then you shouldn't have to worry because the season and episode in the title will never match a movie.

     

    You'll also want to go through the code below and edit some values to match your system. I left notes on the right side as to what to change, but basically, make sure the variables match your system and then run the script and it should spit out matching files. As long as it matches and everything looks right, then remove the # on the 4th last line and it will actually move stuff.

    #!/bin/bash
    
    #Start with a clear screen
    clear
    
    #Set working directories
    output=/mnt/cache/Media/Output/										#Change this to your handbrake output directory
    media=/mnt/cache/Media/			 									#This should be your media directory
    movies=/mnt/cache/Media/Movies/										#This should be your movies directory
    
    #Search the output directory for new media
    for file in $output*
    do
    	#Parse the movie name from the filename
    	parsedName0=$(echo "$file" | cut -d'.' -f1)
    	parsedName1=$(echo "$parsedName0" | cut -d'/' -f7) 				#Lower or raise the number in f7 until "File parsed to:" shows just the movie name.
    	echo "File parsed to: "$parsedName1
    
    	#Check if the file is a movie
    	movieFolder=$movies$parsedName1
    	if [ -d "${movieFolder}" ]
    	then
    		echo "Movie Folder: "$movieFolder
    		#Move any found files
    		#mv "${file}" "${movieFolder}"; echo "Files Moved"			#Once all the outputs look correct, remove the "#"
    	fi
    	echo ""
    done

     

  6. 10 hours ago, IamSpartacus said:

     

    First off I appreciate your assistance with working this out with me, so thank you 👍.

     

    Yes my tv directory is setup like you have it and for movies it's /mnt/cache/Media/Movies/The Dark Knight/The Dark Knight.mkv.  I can output the files back to the Sonarr and Radarr directories but how would I signal to either of them to import the files since they've already done so?

    See, for movies it would be easy because you can just parse the filename and move it to the matching folder, but TV makes it a bit more difficult because the episodes more than likely wont have the show name in the title. 

     

    As for how to get Radarr or Sonarr to search for them, I'd look at the api and see if there is a way to make it work. I can write something up for movies to get that moved to the proper folder, but TV might take a sec. Granted, there might be someone else on here with more knowledge than I that would be able to get it done easily, haha.

  7. 9 minutes ago, IamSpartacus said:

     

    For the purposes of this process I have a TV and Movie directory under media.  So new media shows up in /mnt/cache/Media/TV and /mnt/cache/Media/Movies.  So i need the converted files to go back into those spots for them to be correct for Plex.

    Ok, so I'm assuming your directories are set up something like 
    /mnt/cache/Media/TV/Shameless/Season 1/episode goes here.mkv

     

    You would then need to parse the filename so try and figure out where it should be stored, otherwise, if you had radarr and sonarr setup then you can always just copy the files back to the download directory of either of those programs and let it import them again. If you could post your naming scheme I can see if there is any way I can think of to try to parse the file and move it to the proper folder automatically. 

     

    I'm also not familiar with how Handbrake outputs the file, does it output it back into a folder like it was originally (ie. /mnt/cache/HandbrakeOutput/Shameless/Season 1/episode.mkv), or does it just spit out the file (ie. /mnt/cache/HanebrakeOutput/episode.mkv)? Obviously enough, if it spits out the whole folder it would make things exponentially easier, but if not, I'm sure we can find a way to get it done.

     

    Also, just know I'm no expert, I'm all self taught when it comes to bash and scripting but I can usually make stuff work. That being said, I am also at work so I may not reply asap but I'd be willing to help where I can 😄
     

  8. 2 hours ago, IamSpartacus said:

     

    I guess that make sense.  I can test that.

     

    For now though, my roadblock is the handbrake /watch and /output folder being the same.  They can't be the same.  So I need a PostProcessing directory and a script that will watch that post processing directory and when it a sees a file in there, copy it back to the original destination under /mnt/cache/Media/.  Not sure how to accomplish this.

    How is your media stored in /mnt/cache/Media/ ? is it all just thrown in the folder because if so, that will be an easy task to accomplish. All you'd need to do is change the line that says "output=/mnt/cache/output/" to wherever Handbrake outputs it's files to. This will then move any files from that directory to your media directory.

    #!/bin/bash
    
    #Set working directories
    output=/mnt/cache/output/
    media=/mnt/cache/Media/
    cd $output
    
    #Search the output directory for new media
    for file in $output*
    do
    #Move any new files from the output directory back to the storage directory
    	mv $file $media
    done

    EDIT: I just thought of another, albeit slight issue. If Handbrake puts the file there while it's still in progress, it'll try and move incomplete files; so to get around this, I'd suggest setting this script to run on either a custom cron job or daily. This would mean a smaller chance of catching half-complete files. 

     

  9. On 2/25/2019 at 11:12 AM, Cessquill said:

    Enable Hardware Decoding in Plex

    
    #!/bin/bash
    
    con="plex"
    
    echo ""
    echo "<font color='red'><b>Applying hardware decode patch...</b></font>"
    echo "<hr>"
    
    docker exec -i $con mv "/usr/lib/plexmediaserver/Plex Transcoder" "/usr/lib/plexmediaserver/Plex Transcoder2"
    docker exec -i $con /bin/sh -c 'printf "#!/bin/sh\nexec /usr/lib/plexmediaserver/Plex\ Transcoder2 -hwaccel nvdec "\""\$@"\""" > "/usr/lib/plexmediaserver/Plex Transcoder";'
    docker exec -i $con chmod +x "/usr/lib/plexmediaserver/Plex Transcoder"
    docker exec -i $con chmod +x "/usr/lib/plexmediaserver/Plex Transcoder2"
    docker restart $con
    
    echo ""
    echo "<font color='red'><b>Done!</b></font>"

     

    Description: Translation of manual steps required to patch Plex docker to enable hardware decoding if you're running an Nvidia version of Unraid.

     

    Quick Start: Set up and run as a script every time Plex updates.  If your container is not called "plex", change the "con" variable (see notes)

     

    Disclaimer: If it can be improved (or if it's dangerously wrong), please let me know.

     

    Notes:

    • Should be run when Plex is installed/updated
    • From the command line, run "docker ps" to see what your plex container is called.  Set that as the "con" variable in your script (mine is "plex")
    • This script is only required until Plex officially supports hardware decoding
    • It preforms the same as recommended in the NVidia plugin support thread here (where it was originally published), namely...
      • Renames the file "Plex Transcoder" to "Plex Transcoder2"
      • Creates a new "Plex Transcoder" file with the suggested contents
      • Changes permissions on both "Plex Transcoder" and "Plex Transcoder2" files (not sure it's required on Transcoder2 - seemed to work for me without)
      • Restarts the Plex container (not sure if required, but doing it anyhow)
    • Probably best nothing is playing whilst the script is run
    • You'll need to have Plex running for the script to work.  Would require different code if stopped (would probably be safer to stop the container first, make the changes then start again, but here we are)
    • Run "nvidia-smi dmon -s u" from the terminal (not within Plex container) to check whether the decoding is working.  Set a video to play in a transcoded state, and the 3rd and 4th columns from the end should be non-zero
    • This includes the "exec" addition to the Plex Transcoder file contents

    Good luck!

    I just tossed a 1050Ti into my server to see if I could get this working, and after running the script (with the right container name) it doesn't seem to be working. It shows that it's encoding, but the decoding still sits at 0% and I'm not sure why.

     

    Nevermind, I seem to have found out why. It looks like this script only works on version 1.15+ and I'm just running 1.14 so I need to wait until the alpha is pushed to the main channel before it will work.

  10. Just in case someone else has this error, since I had a hard time finding any solution that wasn't just "Your SSD is dead" here is what I did to fix my situation: 

     

    • As johnnie.black suggested, I ensured I still had my backup of my AppData (the only thing on my cache drive) and then I shut down the array.
    • I removed the cache from the array (not physically, just in software)
    • Using unassigned devices, I formatted the cache completely
    • Re-added the cache back to the array and started it up again.
    • In my situation, I had to rebuild my docker image by re-installing all the dockers individually.
    • I then copied all the AppData back and overwrote all the AppData that was currently there from the fresh installs.

     

    Again, this might be unique to my situation but I knew which file was corrupt because it actually caused a docker to fail, so when I copied all my files back, I left the errored file out (obviously enough, as the whole reason this was being done is to fix that corruption). It seems like it was a file that was corrupt that threw up an error that is the same as what might happen with a failing drive. I also swapped out my cache drive, just to be safe, but considering when I transferred the broken file it threw up the same error, I'm confident that it wasn't the drive with the issue, just that file.

     

    Currently, the 40Gb of Plex metadata is still transferring back but everything else that was transferred seems to have worked flawlessly. I also spent a few hours running memtest, and after a pass, it came back as fine. I'm aware that you should really run it for more than just one pass, but I wanted to start the transfer. Once everything is confirmed to be back up and running, I plan on running memtest for the whole weekend and then seeing how it fairs.

     

    Thanks for everyone here and on Reddit who helped with the solution!

  11. Just now, johnnie.black said:

    It's an unusual error, but there's metadata corruption so I would recommend backup, re-format and restore, you can use this if needed to help with the backup/restore.

     

    Also a good idea to run memtest see if anything pops up.

    Yea, I really only had appdata on the cache so I have that backed up. I even changed the drive over and then restored the data and it still has that error. I'm thinking my next step is to avoid the file that I suspect is causing the issue and then restore everything but that. My main concern is that hopefully my Plex, Sonarr, and Radarr data is fine, everything else is replaceable easily.

     

    Thanks for the support!

  12. So A few days back I noticed that one of my dockers was not started as it should be. The logs showed that the config directory wasn't where it should be, which I found odd because when I went to look for it, all the files showed up as they should. I thought this was an error with an update to the docker where maybe the actual application code was looking in the wrong spot, maybe a typo or something.

     

    I left it as is and just didn't use the application for a day or two, until yesterday. I needed to reboot for something so I did, and while watching all the text fly-by I noticed that there was an error along the lines of BTRFS critical error: unable to find logical 123189231236 found 4096 (the numbers aren't exactly correct as they're off the top of my head) but I noticed anytime I enter the directory, the files are no longer there and that error pops up again.

     

    First I thought that the SSD was failing, so, no biggie, I'd just install the spare I have which is also larger. In addition, all my searching online seems to back this up, and all the documentation I can find regarding that error says it's bitrot, or something. However, when I swapped the new drive in and copied my appdata over, I continue to get that error when I'm looking for the same file.

     

    Lastly, I also goofed because I tried to open a 35gb zip file in krusader which seems to have massively inflated the size of my docker image so I thought I'd move it off the cache to the array. I followed steps to move it, and then decided to just rebuild the whole darn thing. Either way, I must have messed something up because now it shows I have 0 dockers installed, but really, I've got backups of the appdata, so that's no big deal, I'll just reinstall.

     

    I just thought I would post here, and see if anyone has any suggestions because I can now no longer delete the directory that is "corrupt" as it shows an I/O error, so I'm wondering if anyone has experienced this, or knows a solution for how to even just delete the directory?

     

    I'm at work, so I don't have access to my server to test but I thought I'd fish for suggestions here, and worst case, pull the cache, completely format it on my windows machine, and then start over, but bypass copying back the folder that I'm assuming is "corrupt",

  13. As of today I'm suddenly unable to use this. I keep getting an error  "No OpenVPN config file located in /config/openvpn/ (ovpn extension), please download from your VPN provider and then restart this container, exiting..." however, nothing has changed, just overnight it has stopped working. I double checked and the config files are still there, and if I edit the docker to add a path to /config/openvpn/ directly to the files it still shows they aren't there. I'm wondering if there was an update that may have broken a link somehow?

  14. Yea it's got /boot and /config I've copied both folders to a backup on my PC and am in progress of rewriting the drive.

     

    I'm thinking I only messed up a single file possibly, which could be causing my issues booting?

     

    EDIT: hmm, just looking at the newly created drive and it doesn't have /boot/ but in comparing it to the folder the old drive had, the /boot/ folder is the same as the new drive's root folder... weird. I'm going to attempt copying the whole /boot folder to the root of the drive and see if that fixes it...

  15. Admittedly, this is my screw up, and I know it's my fault, but now I'm just looking to see how I can hopefully recover my system.

     

    I was playing around with a rename script (using mv) to change files from "S01E01 - title.mp4" to "title.mp4" by removing all the text up to the first dash. However, I forgot to surround my script in an if statement, and also seem to have made a typo in the directory, so it ran the script in the root directory.

     

    I immediately shut the server down, hoping that it wouldn't just delete my whole server (media included) and thankfully, it wasn't running recursively, that I know of at least. Now, when I boot the server it brings up the boot options menu and just loops there. "Booting in 5,4,3,2,1" and then back to 5 again.

     

    It seems like I obviously messed up the boot settings or a file but I can't get it to boot anymore. I'm pretty sure my media is still there (hopefully) but I just can't get it to boot. I've emailed unraid to see what they say, and hopefully, I can fix my boot drive and get it back up, but I'm not sure. 

     

    My hope is that maybe someone smarter than myself can assist in getting my server back up and running, as I just started playing with Unraid a few months ago, and don't know much when it comes to Linux or unraid.

     

    Thanks for reading!

     

     

×
×
  • Create New...