Jump to content
Squid

Additional Scripts For User.Scripts Plugin

313 posts in this topic Last Reply

Recommended Posts

Posted (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 :D

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 by Xaero

Share this post


Link to post

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.

 

Share this post


Link to post

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 :P

 

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

 

Share this post


Link to post
9 minutes ago, davis999 said:

"No space left on device" error

That's normal, just means dd reached the end of the device.

Share this post


Link to post

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).

Share this post


Link to post

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"

 

Share this post


Link to post
Posted (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 by fluisterben

Share this post


Link to post
Posted (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 by zacharyd3
clarified the answer

Share this post


Link to post
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.

Share this post


Link to post
Posted (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 by zacharyd3
added link

Share this post


Link to post

The dynamix schedules plugin. It’ll set a time for the preset schedules system wide.

Share this post


Link to post
On 5/23/2019 at 2:26 PM, Aluavin said:

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?

I'm currently running this docker;

https://github.com/adferrand/docker-letsencrypt-dns

I export the cert from the docker so all on unraid can access the cert. I use 1 cert for a lot of names. I believe LE allows you to have 100 within 1 cert, including wildcard certs (for subdomains).

 

Share this post


Link to post

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.