Additional Scripts For User.Scripts Plugin


Recommended Posts

4 hours ago, itimpi said:

Sounds like you forgot to check the checkbox under Tools >> New Config confirming that you want to run the operation?   Until you have done that the Apply button will not be active.

 

however if you are intending to replace the drive why not simply use the normal procedure for Replacing a Disk Drive which does not involve you going via the Tools >> New Config route (although both options are viable).

Got it.  You were right. 

 

May be useful to move the checkbox are you sure you want to do this, so it's not under the drop down of the things you want to select first?

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

So I just ran this on disk 8 of my array (i first moved all the data off it to the other disks in my array), it completed (5TB drive so it took a while), I clicked Done.  I then stopped the array, but when  I went to tools>new config and checked all for Preserve current assignments,  It didn't give me the option for apply, just Done.  And I can't remove the drive from my array.  I am using unraid 6.8.3 nvidia and don't have any parity drives at the moment.

 

Basically this drive is showing old, and before it starts to fail I want to remove it from the array, and replace it with a new 6TB drive.

 

Am I going about this the wrong way and/or is there an easier way for me to remove a drive from my array without any parity?

If you don't have any parity then you don't have to run this script.  With the array stopped just pick no device for that slot and go with the new config keep current assignments....  as I understand it.  Now I've never tried this with no parity drive assigned..  So maybe there is a bug there...

 

The whole Idea with the zeroing drive script is to keep parity valid while you remove a drive from the array.  But you don't have parity so you should be able to just pull the drive.

 

You could also try "new config" without the preserve and just re-assign.  Just make sure you take a picture or write down the current assignments so you can duplicate them...

 

What I did with the array stopped was to remove the drive from the list first, then I did the new config with preserve and it worked fine for me.

 

Jim

 

 

Edit:  Now I see this was already replied to!  Stupid browser not bringing me to the last message!

 

Edited by jbuszkie
Link to comment
On 3/12/2020 at 11:50 AM, jbuszkie said:

*Sigh*  Everyone may know this but I didn't...  When using user scripts if you click outside the script window in the main window that will also kill the script.  So not just hitting the "X"..  I was about a 1/4 into zeroing out a drive when I accidentally click outside the script window and killed it! *sigh*

Fixed on today's update

  • Like 1
  • Thanks 1
Link to comment
  • 2 weeks later...

I'm running the clear array drive script in a screen right now.  In the evening, my server is under a pretty heavy load.  Is there any issue in just doing a ctrl-z to pause the process and then resume it later?

 

2nd question.  I have a cleared a drive and rather than remove it, want to replace it with a bigger drive that has already been pre-cleared, can I do that all in one step while preserving parity?

Link to comment

Hi everyone,

 

I'm really noob with no idea where to start...

 

I was thinking a way to restart a docker container (easy job, already found the script) ONLY IF the network traffic is below a defined threshold.

Do you have suggestion?

 

My need is to schedule (every hour) the restart of qbittorrent container to workaround the frequent hangs.

 

Thanks in advance!! 

Link to comment
5 hours ago, jimmy898 said:

Hi everyone,

 

I'm really noob with no idea where to start...

 

I was thinking a way to restart a docker container (easy job, already found the script) ONLY IF the network traffic is below a defined threshold.

Do you have suggestion?

 

My need is to schedule (every hour) the restart of qbittorrent container to workaround the frequent hangs.

 

Thanks in advance!! 

Not sure I understand why the traffic threshold, is the docker getting really hung? (no qbittorent web page loading) or you mean a stalled download?

 

To simply restart hourly, how about making short user script with:

docker restart {dockername}

 

and cron schedule it on the right side --> Custom, and use: 0 * * * *

this will trigger a restart every hour on the hour

Edited by guru69
Link to comment
7 minutes ago, guru69 said:

Not sure I understand why the traffic threshold, is the docker getting really hung? (no qbittorent web page loading) or you mean a stalled download?

The aim to perform the restart only if the traffic is low, while with high values (eg 600+ KB/s) the scrit wont start.

It's crazy? Is there any simpler way to achive this?

 

BTW thanks for the hourly script hint!!

Edited by jimmy898
typo
Link to comment

You might be able to script that, but if your speeds keep dropping, its probably better to solve the underlying problem than keep restarting the docker.

I'm having no issues with the linuxserver/qbittorrent docker

Are you using a VPN?

If not your provider might be the cause of any speed loss, stalling, etc.

Another thing that can help is to use a private tracker

 

Link to comment
2 minutes ago, guru69 said:

You might be able to script that, but if your speeds keep dropping, its probably better to solve the underlying problem than keep restarting the docker.

I'm having no issues with the linuxserver/qbittorrent docker

Are you using a VPN?

If not your provider might be the cause of any speed loss, stalling, etc.

Another thing that can help is to use a private tracker

 

Speed drops are not so frequent, actually 1/2 in few days. Anyway in my experience a periodic restart of binhex-qbittorrentvpn container keep it much healthy and allow to avoid subdole hangs that may stay pending for hours.

 

Sometimes is the VPN provider (Surfshark) that drop the connection, it's a great service price/quality and I'm very happy with it though.

 

Do you have any idea how to setup the script?

 

Thanks!

Link to comment

Add a new user script, replace qbittorrent with your vpn docker name in Unraid

something like this:

 

#!/bin/bash
arrayStarted=true
noParity=true

docker restart qbittorrent

Once its saved, click "Run Script" in User scripts to make sure its restarting your docker. If it works, click the dropdown on the right and change from "Schedule disabled" to "scheduled hourly". Click Apply at the bottom.

Link to comment

Clear an unRAID array data drive - Potential Issue

 

I am currently running the CLEAR AN ARRAY DRIVE plug-in.  It was about 2 hours into the process with the window open to the script update when my PC restarted due to a windows update. 

 

After restart the script window was of course no longer open.  It appears based on drive traffic that the script is still running.  What should I do?

 

Find a way to stop the script?  What is the best way?

Let it run an assume it is good once drive traffic stops?

Other?

 

 

Edited by dubbly
minor text correction - clarify plugin
Link to comment
50 minutes ago, dubbly said:

Clear an unRAID array data drive - Potential Issue

 

I am currently running the clear an array plugin on a drive.  It was about 2 hours into the process with the window open to the script update when my PC restarted due to a windows update. 

 

After restart the script window was of course no longer open.  It appears based on drive traffic that the script is still running.  What should I do?

 

Find a way to stop the script?  What is the best way?

Let it run an assume it is good once drive traffic stops?

Other?

 

 

If you are running the Preclear plugin, it will continue running on your Unraid server. Click the Preclear plugin icon to see the progress again (and the result when done)

Link to comment
56 minutes ago, jimmy898 said:

Thanks!

tTo add an if condition related to network traffic is a mess or something achivable?

Inviato dal mio moto g(6) plus utilizzando Tapatalk
 

There might be some way, but you are talking about vpn traffic inside your docker, not sure how you would measure that. Maybe someone else here has some ideas.

Link to comment
29 minutes ago, guru69 said:

If you are running the Preclear plugin, it will continue running on your Unraid server. Click the Preclear plugin icon to see the progress again (and the result when done)

 

Updated posting to make the plug-in clear. I am using the Clear an Array Drive Plug-in.  Relaunching the plug-in doesn't open up the status.  It just runs from the start again but can't because it is running on the drive that I am clearing.

 

Not sure what to do.  Either let it finish and hope that it worked or restart the server?

 

 

Edited by dubbly
clarity update
Link to comment
On 4/4/2020 at 6:48 PM, guru69 said:

There might be some way, but you are talking about vpn traffic inside your docker, not sure how you would measure that. Maybe someone else here has some ideas.

Sorry for the late reply. No need to check only container specific traffic, br0 it's fine too.

I'm trying with the following scripts:

 

#!/bin/bash

R1=`cat /sys/class/net/br0/statistics/rx_bytes`
T1=`cat /sys/class/net/br0/statistics/tx_bytes`
sleep 10
R2=`cat /sys/class/net/br0/statistics/rx_bytes`
T2=`cat /sys/class/net/br0/statistics/tx_bytes`
TBPS=`expr $T2 - $T1`
RBPS=`expr $R2 - $R1`

TRTOT=`expr $TBPS + $RBPS`

TOTKBPS=`expr $TRTOT / 10240`

if [ $TOTKBPS -lt 300 ]

then
        arrayStarted=true
        noParity=true

        docker restart binhex-qbittorrentvpn
fi

It should works!

 

Link to comment
  • 3 weeks later...
On 9/4/2016 at 1:06 AM, RobJ said:

The included 'clear_array_drive' script can now be run at the command line within any unRAID v6

Why exactly is this script necessary if there are no shares on the drive? It's currently running at 3.5 MB/s even with Turbo Write and I can't see any way to interrupt it.

Link to comment
47 minutes ago, johnnie.black said:

Don't know, never used the script, try ctrl + c, already linked you the correct instructions.

How can I ctrl + c when it's running in a iframe on /Settings/Userscripts? I went through ps aux and killed all the matching process names but it was still running so I killed the dd process too. I hope that's correct.

 

And how can I avoid following incorrect instructions in the future? Are users seriously expected to dig up a 2.5 year old mid-thread comment rather than follow the official wiki instructions?

 

As for my originally question, why is any of this necessary if the disk has no data on it at all and there is no parity?

 

Edited by cinereus
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.