[Plugin] CA User Scripts


Recommended Posts

11 minutes ago, ratmice said:

Just to be extra clear (paranoid) the UnRAID managed device number should always be the same as the disk number, correct? So if I need to zero disk 16, I would use md16. Sorry for the cluelessness.

Yep.

 

P.S. if the other disk is already failing, with read errors/pending sectors, don't enable turbo write, it will take longer but only parity and the disk being removed will be accessed.

Link to comment
  • 3 weeks later...
On 6/26/2016 at 1:14 PM, dlandon said:

How about the option to run the script in the background so the webgui does not get tied up with the script.

 

I just created a script to back up my VM and it takes a while.  I'd like to be able to run the script and move on to other things while it runs.  I will add a notification event to the script let me know it is done.

dlandon - Are you still using the script you mention here. If so would you be willing to share it? I'd love an automatic way to backup my VM images to a separate NAS i have on my network (It's mounted in Unraid as an NFS volume)

 

Thanks in advance.

Andrew

Link to comment
29 minutes ago, aderrington said:

dlandon - Are you still using the script you mention here. If so would you be willing to share it? I'd love an automatic way to backup my VM images to a separate NAS i have on my network (It's mounted in Unraid as an NFS volume)

 

Thanks in advance.

Andrew

Here you go.

#!/bin/bash
#
# Backup MyComputer desktop VM.
#
TIMEOUT=${TIMEOUT:-300}

#
# Stop the VM.
#
echo "Shutdown MyComputer VM"
virsh shutdown MyComputer

echo "Waiting for MyComputer VM to shutdown..."
count=0
while [ $(/usr/sbin/virsh list --name --state-running | grep "MyComputer" | wc -l) -gt "0" ]; do
	if [ "$count" -ge "$TIMEOUT" ]; then
		break
	fi
	count=$(expr $count + 1)
	sleep 1
done

if [ $(/usr/sbin/virsh list --name --state-running | grep "MyComputer" | wc -l) -gt "0" ]; then
	echo "MyComputerVM did not shut down"
	/usr/local/emhttp/webGui/scripts/notify -e "Unraid Server Notice" -s "VM Backup" -d "MyComputer VM Backup failed" -i "normal"
	exit 1
else
	echo "MyComputerVM successfully shut down"
fi

#
# Copy VM to array Computer Backups
#
echo "Copy MyComputerVM to array..."
rsync -a -v --delete /mnt/user/system/domains/MyComputer /mnt/user/Computer\ Backups/VM_BACKUPS/

#
# Start the VM.
#
echo "Start MyComputer VM..."
virsh start MyComputer

/usr/local/emhttp/webGui/scripts/notify -e "Unraid Server Notice" -s "VM Backup" -d "MyComputer VM Backup completed" -i "normal"
echo "MyComputerVM Backup Done"

It shuts down the VM normally and waits a certain amount of time to be sure it has stopped, backs up the VM to the array and then restarts the VM.  This performs a full shutdown of the VM and not a hibernate.

 

Change 'MyComputer' to the name of your VM.  You'll have to adjust the rsync destination to your NFS share.  Over the network, a sizable VM could take a while.

Edited by dlandon
Link to comment

Just wondering if there is an option to run a script every time I am updating specific unraid docker container? 

 

e.g if I update home-assistant docker - run script to install SSHpass, NetCat, etc....

 

I manage to do it manually (even in the HA GUI) but as usual Automatic is the best

 

p.s my script that I am running manually Via VScode/cloud9 container:

https://github.com/VirtualL/HomeAssistant-Config/blob/master/scripts/install_Comp_after_Update.sh

 

 

Edited by VirtualL
Link to comment
  • 2 weeks later...

Hi, Ive been running a reddit image downloader and come across a small problem with character encoding in the log output, it seems the plugin doesnt support UTF-8/emojis i.e and . so ive had to edit the script to strip these characters from the filenames which is not ideal. Just wanted to let you know incase theres and easy fix thanks.

Link to comment
3 hours ago, richowen said:

Hi, Ive been running a reddit image downloader and come across a small problem with character encoding in the log output, it seems the plugin doesnt support UTF-8/emojis i.e and . so ive had to edit the script to strip these characters from the filenames which is not ideal. Just wanted to let you know incase theres and easy fix thanks.

The output is actually HTML with some common formatting converted (ie: \n to <br>)

Link to comment
52 minutes ago, hawihoney said:

Stupid question: Can I start a user script from another user script. And if yes, how?

 

Many thanks in advance.

 

echo "/boot/config/plugins/user.scripts/scripts/NameofScript/script" | at now

Be sure to verify the path is actually what you think it is.

Link to comment
7 hours ago, nuhll said:

some pages ago someone posted something about encoders for plex... what is the benefit of it? Does it enable to use something you normally only get when buying plex pass?

It allows you to use NVDEC with Plex. Basically what happens is it uses the GPU to decode the media before sending it to the client so the client doesn't have to decode the stream.

 

You will still need plexpass to be able to use Hardware Transcoding.

Link to comment

Hi. Does any one else have problems been able to click the hyperlink to edit a script in Android / Google Chrome ?

 

Works fine on a PC but on a tablet or phone the dialogue will not appear ?

 

It would be handy some times but it's not the end of the world.

 

Thanks

 

Terran

 

Edited by ccsnet
Link to comment
11 hours ago, ccsnet said:

Hi. Does any one else have problems been able to click the hyperlink to edit a script in Android / Google Chrome ?

 

Works fine on a PC but on a tablet or phone the dialogue will not appear ?

 

It would be handy some times but it's not the end of the world.

As far as I'm aware it doesn't work on a touch interface.  On my touch screen laptop I have to remember to use the mouse.

  • Like 1
Link to comment

So i have a question. I am screwing up some how on the plex script. I wanted to see if anyone had an idea on how to fix this. Any help would be greatly appreciated. Thanks. I it was working perfect in the unraid rc8 and i had problems with the update and had to go backwards to 6.6.7 and now I am getting this.

Screen Shot 2019-05-11 at 11.02.08 AM.png

Edited by acozad1
Link to comment
1 hour ago, acozad1 said:

So i have a question. I am screwing up some how on the plex script. I wanted to see if anyone had an idea on how to fix this. Any help would be greatly appreciated. Thanks. I it was working perfect in the unraid rc8 and i had problems with the update and had to go backwards to 6.6.7 and now I am getting this.

Screen Shot 2019-05-11 at 11.02.08 AM.png

 

Please don't ask the same question on multiple threads. You didn't even reference the other thread where there was already a discussion going on about your problem. Your problem isn't likely related to this plugin anyway. And you didn't give any more information than you had already given on that other thread, even though you were told there that you hadn't given us enough information.

 

Crossposting has been considered a bad thing on message boards since long before the world wide web. How can we coordinate our responses when there are discussions going on multiple threads. It just wastes time and effort.

 

Please reconsider if you think about doing this again. If you want I will delete your post and mine on this thread, or I can split them from here and put them back on that other thread.

Link to comment

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.