Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Is parity check running?

Featured Replies

I've written a script that will run an encoding job with Handbrake whenever a file is found in a certain directory. Everything works great. I also check to make sure HandbrakeCLI is not already running before queuing any new file in the directory.

 

I would also like to prevent the encode queue if the parity check is currently running. How can I check this in a script?

 

Many thanks

 

I'm using unRaid 4.5

I've written a script that will run an encoding job with Handbrake whenever a file is found in a certain directory. Everything works great. I also check to make sure HandbrakeCLI is not already running before queuing any new file in the directory.

 

I would also like to prevent the encode queue if the parity check is currently running. How can I check this in a script?

 

Many thanks

 

I'm using unRaid 4.5

 

you need to use the following as a guide.  If parity sync is not running you get this

root@Tower:/boot# /root/mdcmd status | grep Resync

mdResync=0

 

If it is running, you get something like this:

root@Tower:/boot# /root/mdcmd status | grep Resync

mdResync=976762552

mdResyncPos=90240

mdResyncPrcnt=0.0

mdResyncFinish=3605.2

mdResyncSpeed=4512

 

You can basically just grep for "mdResync="  If it is anything other than 0, a parity check is running.

 

  • Author

Thanks for the quick reply. Executing /root/mdcmd status | grep Resync gives me one of the two result (while parity is running) in telnet...

 

Binary file (standard input) matches

 

OR

 

mdResync=1465138552
mdResyncPos=1029122472
mdResyncPrcnt=70.2
mdResyncFinish=86.7
mdResyncSpeed=83788

 

I'm a novice at scripting, but not a total n00b. Could you help a little more with the code?

 

#!/bin/bash
if [ $(/root/mdcmd status | grep Resync) -ne 0 ]
then
echo "Parity running"
else
echo "Not Running"
fi

 

 

  • 1 month later...
  • Author

Just a note. If parity is not running, you need to add the -a option to grep

 

	if [ $(/root/mdcmd status | grep -a Resync= | cut -c10) == '0' ]
then
	echo "### Parity NOT running ###"
fi

 

if [ `/root/mdcmd status | grep -aw mdResync | awk -F= '{print$2}'` != 0 ]; then

   echo "Parity check in progress"

   return 1

fi

 

 

 

Your version of just doing grep-a Resync could have problems in the event where parity check is running as grep would return multiple lines and the test statement won't handle it.

the -w flag forces grep to match the word entirely.

 

awk -F= '{print$2}' is a neater way of selecting the data after the equal sign IMO

if [ `/root/mdcmd status | grep -aw mdResync | awk -F= '{print$2}'` != 0 ]; then

   echo "Parity check in progress"

   return 1

fi

 

 

 

Your version of just doing grep-a Resync could have problems in the event where parity check is running as grep would return multiple lines and the test statement won't handle it.

the -w flag forces grep to match the word entirely.

 

awk -F= '{print$2}' is a neater way of selecting the data after the equal sign IMO

 

And yours might choke if something other than a numeric value is returned at some point in the future, or nothing is returned.  Probably better to put the "0" in "quotes" as well as the entire `grep ...| awk ` command"

 

if [ "`/root/mdcmd status | grep -aw mdResync | awk -F= '{print $ 2}'`" != "0" ]; then

    echo "Parity check in progress"

    return 1

fi

And yours might choke if something other than a numeric value is returned at some point in the future, or nothing is returned. 

 

Future proofing - good catch  ;D

  • Author

Thanks all. I'm still learning.

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.