Xaero Posted April 24, 2019 Share Posted April 24, 2019 (edited) 8 hours ago, MowMdown said: There is a bug in your new code specifically: command="/usr/lib/plexmediaserver/plex-nvdec-patch.sh" if [ "$codec_arguments" ]; then #This line is recursive, it duplicates the codecs in the Plex Transcoder file (we don't need it) #command+="${codec_arguments}" docker exec -i "$con" /bin/sh -c "${command}${codec_arguments}" else docker exec -i "$con" /bin/sh -c "${command}" fi What ends up happening is that in the "Plex Transcoder" file, you end up with ALLOWED_CODECS=("h264" "hevc" "h264" "hevc") Removing that line of code fixes the issue. You don't need to concatenate the "command+="${codec_arguments}" because it's already being taken care of at the next line where the docker exec code is taking place. HAHAHA I can't believe I left that in there. Originally, I was using /bin/bash -c which resulted in a bashism making the concatenation cause the script in the container to error out with "invalid codec: vp9" even though it was totally valid. Switching for sh -c fixed it but I left my concat workaround in there. Thanks for the fix EDIT: I have moved wget to the HOST side in the latest revision of the script. neither curl or wget is guaranteed to be present inside the docker, since this script was written for unraid, and unraid ships with wget stock - we're using that. I could add a pure bash download function - but that seems unnecessarily complicated. Edited April 24, 2019 by Xaero 1 Quote Link to comment
glave Posted May 13, 2019 Share Posted May 13, 2019 Is there a way to trigger a notification to be sent from unraid's notification system? I have sonarr move TV episodes it replaces to a .deletedBySonarr folder and over time they can get pretty big if I don't catch it. I'd like to make a script that checks the size of that folder and if it's larger than X GBs send me a notification. Quote Link to comment
JorgeB Posted May 13, 2019 Share Posted May 13, 2019 14 minutes ago, glave said: Is there a way to trigger a notification to be sent from unraid's notification system? Yes: https://forums.unraid.net/topic/61996-cron-jobs-notify/?do=findComment&comment=607842 Quote Link to comment
davis999 Posted May 20, 2019 Share Posted May 20, 2019 Hi folks. I was attempting to run the "clear an array drive" script in preparation for removing some smaller drives. I marked one 2TB drive with `clear-me` folder and launched the script. Just checked the status of it the next day and i see a "No space left on device" error is shown in script output. Has anyone seen this before with this script? Not clear on what this means but im assuming the script was not successful Here is the full script output: Script location: /tmp/user.scripts/tmpScripts/clear an array drive/script Note that closing this window will abort the execution of this script *** Clear an unRAID array data drive *** v1.4 Checking all array data drives (may need to spin them up) ... Found a marked and empty drive to clear: Disk 3 ( /mnt/disk3 ) * Disk 3 will be unmounted first. * Then zeroes will be written to the entire drive. * Parity will be preserved throughout. * Clearing while updating Parity takes a VERY long time! * The progress of the clearing will not be visible until it's done! * When complete, Disk 3 will be ready for removal from array. * Commands to be executed: ***** umount /mnt/disk3 ***** dd bs=1M if=/dev/zero of=/dev/md3 status=progress You have 60 seconds to cancel this script (click the red X, top right) Unmounting Disk 3 ... Clearing Disk 3 ... 2000357949440 bytes (2.0 TB, 1.8 TiB) copied, 36837 s, 54.3 MB/s dd: error writing '/dev/md3': No space left on device Quote Link to comment
JorgeB Posted May 20, 2019 Share Posted May 20, 2019 9 minutes ago, davis999 said: "No space left on device" error That's normal, just means dd reached the end of the device. Quote Link to comment
davis999 Posted May 20, 2019 Share Posted May 20, 2019 Thanks for the reply @johnnie.black. I guess the thing that trips me up is the fact the done logs from script were not output. I looked in the syslog and don't see any signs of them there either. Seems like the script just died after 'dd' command completed. Anyway given that 'dd' completed i guess I can assume it did what needs to be done since i see no other meaningful commands after that. Guess i'll try this with the other drives i plan to remove and see how they go. Btw, i hadn't looked at the done messages in script until after i sent my first message. I see it specifically calls out the fact that "no space left on device" error may occur and that it is not an issue (ie. is expected). Quote Link to comment
Aluavin Posted May 23, 2019 Share Posted May 23, 2019 Currently I have a Script which starts letsencrypt docker (which just gets a cert from LE via DNS Challenge) then copies the cert to my usb device so my unraid has a green lock. But it feels kinda rocky, anyone has a Idea how to improve this script? #!/bin/bash echo "Starting Docker" docker start letsencrypt-server echo "Wait for 60s" sleep 10 echo "Wait for 50s" sleep 10 echo "Wait for 40s" sleep 10 echo "Wait for 30s" sleep 10 echo "Wait for 20s" sleep 10 echo "Wait for 10s" sleep 10 echo "Copy Files" cp /mnt/user/appdata/letsencrypt/keys/letsencrypt/priv-fullchain-bundle.pem /boot/config/ssl/certs/Columbus_unraid_bundle.pem echo "Stopping docker letsencrypt-server" docker stop letsencrypt-server echo "Wait for 10s" sleep 10 echo "Done" Quote Link to comment
fluisterben Posted May 24, 2019 Share Posted May 24, 2019 (edited) 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. Edited May 24, 2019 by fluisterben Quote Link to comment
zacharyd3 Posted May 24, 2019 Share Posted May 24, 2019 (edited) 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 * * * Edited May 24, 2019 by zacharyd3 clarified the answer Quote Link to comment
fluisterben Posted May 24, 2019 Share Posted May 24, 2019 2 minutes ago, zacharyd3 said: Checkout this link to easily use cron: https://crontab.guru/ 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. Quote Link to comment
zacharyd3 Posted May 24, 2019 Share Posted May 24, 2019 (edited) 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 Edited May 24, 2019 by zacharyd3 added link 1 Quote Link to comment
wgstarks Posted May 24, 2019 Share Posted May 24, 2019 The dynamix schedules plugin. It’ll set a time for the preset schedules system wide. Quote Link to comment
Helbirden Posted July 30, 2019 Share Posted July 30, 2019 (edited) Hi there, I'm currently combining two Unraid servers into one and was planning on using the "Clear an unRAID array data drive" script for one of the drives so I have enough room to move the rest of the files over while keeping parity (I moved everything off that one already) I was wondering if the script will leave the drive in a pre cleared state ready to be added to the new array or if I will need to preclear it also? Thanks for any support EDIT1: (Basically have another new drive needing preclearing and wondering if I install it tonight so both are done at same time or just wait if I have to do it on the "old" one anyway. I don't like opening the case every time especially since its running my xeoma cam server atm) EDIT2: Um at the current speed, ~3.7MB (with recon write) its going to take 11.6 days so I'm just gonna install a new drive and which should have enough space for the rest of the files. Edited July 30, 2019 by Helbirden Quote Link to comment
JonathanM Posted July 30, 2019 Share Posted July 30, 2019 6 hours ago, Helbirden said: I was wondering if the script will leave the drive in a pre cleared state ready to be added to the new array or if I will need to preclear it also? I know you already figured out a solution, but for completion's sake, the script doesn't add the preclear signature, it only zeroes the disk. So, no, even though the disk is clear, it's not going to be accepted as such if you add it back to a parity protected array. Quote Link to comment
luca2 Posted July 30, 2019 Share Posted July 30, 2019 Hi, I am still a linux noob. Sorry if i ask a too simple question. Where is actually stored the output of the script : Quote viewDockerLogSize Rgds Quote Link to comment
Squid Posted July 30, 2019 Author Share Posted July 30, 2019 11 minutes ago, luca2 said: viewDockerLogSize Easier to simply get it from the docker tab, calculate container size Quote Link to comment
luca2 Posted July 30, 2019 Share Posted July 30, 2019 33 minutes ago, Squid said: Easier to simply get it from the docker tab, calculate container size OK, got it. thx! Quote Link to comment
jpowell8672 Posted August 16, 2019 Share Posted August 16, 2019 On 7/24/2016 at 11:17 AM, Squid said: Record Disk Assignments Records your current disk assignments to a file on the flash drive called DISK_ASSIGNMENTS.txt (config folder). Not necessary if you run CA's appdata backup as that's done automatically #!/usr/bin/php <?PHP $availableDisks = parse_ini_file("/var/local/emhttp/disks.ini",true); $txt .= "Disk Assignments as of ".date(DATE_RSS)."\r\n"; foreach ($availableDisks as $Disk) { $txt .= "Disk: ".$Disk['name']." Device: ".$Disk['id']." Status: ".$Disk['status']."\r\n"; } file_put_contents("/boot/config/DISK_ASSIGNMENTS.txt",$txt); echo "Disk assignments have been saved to the flashdrive (config/DISK_ASSIGNMENTS.txt)\n"; ?> record_disk_assignments.zip 891 B · 57 downloads No longer works Quote Link to comment
trurl Posted August 16, 2019 Share Posted August 16, 2019 On 7/30/2019 at 12:20 AM, Helbirden said: Um at the current speed, ~3.7MB (with recon write) its going to take 11.6 days Something is not right with that. Most likely you have connection issues with one or more disks. You must double-check all connections any time your are in the case. Post your diagnostics. Quote Link to comment
JoeUnraidUser Posted August 17, 2019 Share Posted August 17, 2019 (edited) Script to convert text files from DOS to Unix format. dos2unix #!/bin/bash # Convert text files from DOS to Unix format. if [ $# -eq 0 ] || [ "$1" == "--help" ] then printf "Usage: dos2unix <files>...\n" exit 0 fi for file in "${@}" do user=$(stat -c '%U' "$file") group=$(stat -c '%G' "$file") perms=$(stat -c "%a" "$file") tmp="$file.$(date +%N)" cat "$file" | fromdos > "$tmp" mv "$tmp" "$file" chown $user:$group "$file" chmod $perms "$file" done Script to convert text files from Unix to DOS format. unix2dos #!/bin/bash # Convert text files from Unix to DOS format. if [ $# -eq 0 ] || [ "$1" == "--help" ] then printf "Usage: unix2dos <files>...\n" exit 0 fi for file in "${@}" do user=$(stat -c '%U' "$file") group=$(stat -c '%G' "$file") perms=$(stat -c "%a" "$file") tmp="$file.$(date +%N)" cat "$file" | todos > "$tmp" mv "$tmp" "$file" chown $user:$group "$file" chmod $perms "$file" done Edited August 17, 2019 by JoeUnraidUser 1 Quote Link to comment
Squid Posted August 17, 2019 Author Share Posted August 17, 2019 On 8/16/2019 at 2:42 AM, jpowell8672 said: No longer works Script works perfectly fine. What you were doing though is copying and pasting the script via the forum which occasionally adds some hidden characters, resulting in a broken script. Changing the plugin to remove the unprintable characters when pasting into the edit box 1 Quote Link to comment
jpowell8672 Posted August 17, 2019 Share Posted August 17, 2019 3 hours ago, Squid said: Script works perfectly fine. What you were doing though is copying and pasting the script via the forum which occasionally adds some hidden characters, resulting in a broken script. Changing the plugin to remove the unprintable characters when pasting into the edit box Thanks, yes I am guilty of copying & pasting. It's the easiest & quickest way to add a script. Did not know that would break it, but now I know. I would have copied to folder but my smb sharing has not been working in unraid for a while now. The only way I can transfer to unraid at this point is through usb drive through unassigned devices & krusader. Quote Link to comment
rorton Posted October 22, 2019 Share Posted October 22, 2019 Does anyone have a copy script that will work like this... Existing share on an unassigned drive Want to back this up to the array daily (so schedule a user script) Would like it to look at the initial backup that was made, and then just append to keep it up to date. I have all my mp3's on a SSD for fast reading from my Mac in iTunes, plus sonos around the house, but would like them on the array too incase the SSD dies. Quote Link to comment
rbronco21 Posted December 13, 2019 Share Posted December 13, 2019 I'm using "Clear an unRAID array data drive" to clear disks for encryption. The script stopped at 40GB on my 8TB disk and I am not sure what state I am in now. Can I try it again? Do I need to rebuild it before anything else? Quote Link to comment
JorgeB Posted December 13, 2019 Share Posted December 13, 2019 1 hour ago, rbronco21 said: I'm using "Clear an unRAID array data drive" to clear disks for encryption. The script stopped at 40GB on my 8TB disk and I am not sure what state I am in now. Can I try it again? Do I need to rebuild it before anything else? That script isn't working correctly (or it's very slow) with current Unraid, you can still do it manually. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.