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.

Script for unRaid status and (partial) management from the telnet prompt

Featured Replies

I put together a UNIX shell script that allows for some basic management of the unRaid array when logged in via telnet.

 

It is named "unmenu" and might be helpful to some unRaid owners.  It does not perform all functions the web-based interface can perform.  It cannot be used to add a disk to an array, or to format disks, or to initialize the array, or even to start the array if it is stopped.

 

What it can do is show you disk status, disk statistics, and let you start and stop a background parity check.

It can also let you reboot the server, or issue a "powerdown" command to safely stop the array prior to shutting off the power supplies.  All the "management" commands must be typed as upper-case (hold down the shift key when typing the command) This is to help prevent any accidental commands from being issued.

 

To install it, unzip the attachment to this post and drag it to your flash drive. Then

log in via telnet and type:

 

chmod +x /boot/unmenu

 

That will mark it as executable.  Then to invoke it log in via telnet and then type:

 

cd /boot

unmenu

 

The screen on the unmenu refreshes automatically every 30 seconds or whenever a key is pressed on the keyboard.

 

Here are some sample screen shots.

 

Unraid Status...

20gec7s.jpg

 

Unraid Statistics...

20gecl5.jpg

 

Unraid Management (well, a subset)

20geec4.jpg

 

Unraid Stopped

20geeqx.jpg

 

Unraid Restart (If you try to start it using the unmenu) 

20gef6t.jpg

 

Oh, I've tried reversing the steps I found in the "stop" command supplied by Tom to restart the array but it really confused the web-based management page.  When I refreshed the page it showed ALL my drives as "unformatted" and presented a "FORMAT" button to let me re-format them all.  Obviously, this was NOT what I wanted to do.  I instead pressed the STOP button and then the START button and it figured things out.

 

SO.. with this in mind, it is very easy to get the two interfaces out-of-sync with each other.  Be very careful. Press refresh to let it get an idea of what you did behind its back.  If you try hard enough the web-based page will stop responding to you.  In that situation, use the "reboot" option on the unmenu or simply type "reboot" at the command prompt.

 

Have fun... If you get your web-interface confused and it stops responding, at least you will be able to get status from the telnet prompt.

 

This should work for anyone with IDE/PATA drives.  I've never tested it on an array with SATA drives.

 

Joe L.

 

  • 1 year later...
  • Author

A tiny bug with this script was reported by ReneV.  It will incorrectly report the mount point of disks when you have more then 9 data disks.  I never ran into it since I only have 8 data drives in my array.

 

It is easy to fix however.

 

Don't know if you're still maintaining your management script at http://lime-technology.com/forum/index.php?topic=153.0 but

I thought I'd let you know that I expect I'll be using it and that it appears to have a tiny bug. Currently, line 107 reads

 

                            mountpoint[$i]=`grep "${device[$i]}" /tmp/$$mount_status|

 

I think you want to have a space before the second ":

 

                            mountpoint[$i]=`grep "${device[$i]} " /tmp/$$mount_status|

 

Otherwise, the grep for /mnt/disk1 also gets /mnt/disk10 (and presumably so-on up to 15).

 

At this time, attachments are not working... so you will have to edit the line in the script to add the space to fix it yourself.

 

Joe L.

A few layout adjustments, as well (to handle 16 disks):

 

lines 12--21 (inclusive):

   goto_bot=`tput cup 29 1`

   goto_menu10=`tput cup 10 3`

   goto_menu11=`tput cup 11 3`

   goto_menu12=`tput cup 12 3`

   goto_menu13=`tput cup 13 3`

   goto_menu1=`tput cup 23 3`

   goto_menu2=`tput cup 24 3`

   goto_menu3=`tput cup 25 3`

   goto_menu4=`tput cup 26 3`

   goto_command_line=`tput cup 28 1`

 

line 121:

   printf "%2s %15.15s-%-15.15s %-14s %-9.9s %s\n" \

 

  • 3 months later...

NICE JOB.

 

Might want to change the menu prompt to something like

 

[D]isk Status, tatistics, [A]rray Management, [L]og view [Q]uit :

 

D would be 1, S=2, A=3, L(new syslog viewer), Q=4

 

This would eliminate the menu, and make the prompt more intuitive (and save screen space).

 

Just a thought.

 

Oh, Logview would be a new command to view the syslogs.

 

 

 

  • 1 month later...

will this work with current version?

 

 

  • Author

will this work with current version?

 

 

yes.  it still works with 4.3 version.

 

Note: it does not report anything on new "cache" disk, as it is not part of the protected array.

fair enough

 

 

  • 5 months later...

Hi,

 

I am download "unmenu_telnet" from addons site. I am install this script and run.

But in telnet console I see this "bad" result:

root@Tower:/boot# unmenu
: invalid signal specification
: invalid signal specification
: command not found
: command not found
: command not found
: command not found
'/unmenu: line 28: syntax error near unexpected token `
'/unmenu: line 28: `read_key()
root@Tower:/boot#

 

 

Where may be problem?

 

Thanks for answer

 

  • Author

Hi,

 

I am download "unmenu_telnet" from addons site. I am install this script and run.

But in telnet console I see this "bad" result:

root@Tower:/boot# unmenu
: invalid signal specification
: invalid signal specification
: command not found
: command not found
: command not found
: command not found
'/unmenu: line 28: syntax error near unexpected token `
'/unmenu: line 28: `read_key()
root@Tower:/boot#

 

 

Where may be problem?

 

Thanks for answer

 

Sure sounds like the script you downloaded is corrupted in some way.

I did not put the script on the add-on site, nor have I downloaded and tested it.

Did you edit it?  Perhaps you introduced carriage returns at the ends of the lines. (Linux uses line-feed characters, dos and windows uses CR/LF pairs.)

 

Joe L.

Joe L, thanks for replies.

 

I am view "unmenu" script in  MC editor (on UnRaid server). I am see as end of row "^M"

How can I convert "unmenu" file to linux-like forma of EOL ?

  • Author

Joe L, thanks for replies.

 

I am view "unmenu" script in  MC editor (on UnRaid server). I am see as end of row "^M"

How can I convert "unmenu" file to linux-like forma of EOL ?

Look in the wiki FAQ under the question:

Why do my scripts have problems with end-of-lines?

The FAQ is here: http://lime-technology.com/wiki/index.php?title=FAQ

 

To conver from dos format use the following syntax respectively replacing yourfilename with the proper filenames.

 

fromdos < yourfilenamehere  > yournewfilenamehere

 

 

to rename use

 

mv yournewfilenamehere yourfillenamehere

 

 

to convert back to crlf(dos) format use

 

todos < yourfilenamehere > yournewfilenamehere

 

Thanks, thanks, thanks  :)

 

After I am use fromdos < yourfilenamehere  > yournewfilenamehere then unmenu working.

 

Very thanks.

  • 1 year later...

Hello all,

 

I am upgraded my earlier Unraid to Unraid to 4.5.1 PRO. I am tried run unmenu from telnet again. But now I am see on screen repeatedly:

tput: command not found

 

 

Where I can get tput utility?

tput is in ncurses package?

 

 

 

Many thanks for any answer

  • Author

I am transform any command (clearscreen and goto_top) as indicated here http://lime-technology.com/forum/index.php?topic=2817.msg23324#msg23324

 

But I do not know how do transform other commands.

 

Can someone give advaice me?

 

if [ -x /usr/bin/tput ]

then

  clearscreen=`tput clear`

  goto_top=`tput cup 0 1`

  goto_bot=`tput cup 24 1`

  goto_menu10=`tput cup 10 3`

  goto_menu11=`tput cup 11 3`

  goto_menu12=`tput cup 12 3`

  goto_menu13=`tput cup 13 3`

  goto_menu1=`tput cup 18 3`

  goto_menu2=`tput cup 19 3`

  goto_menu3=`tput cup 20 3`

  goto_menu4=`tput cup 21 3`

  goto_command_line=`tput cup 23 1`

  bold=`tput smso`

  norm=`tput rmso`

  ul=`tput smul`

  noul=`tput rmul`

else

  clearscreen=`echo -n -e "\033[H\033[2J"`

  goto_top=`echo -n -e "\033[1;2H"`

  goto_bot=`echo -n -e "\033[25;2H"`

  goto_menu10=`echo -n -e "\033[11;4H"`

  goto_menu11=`echo -n -e "\033[12;4H"`

  goto_menu12=`echo -n -e "\033[13;4H"`

  goto_menu13=`echo -n -e "\033[14;4H"`

  goto_menu1=`echo -n -e "\033[19;4H"`

  goto_menu2=`echo -n -e "\033[20;4H"`

  goto_menu3=`echo -n -e "\033[21;4H"`

  goto_menu4=`echo -n -e "\033[22;4H"`

  goto_command_line=`echo -n -e "\033[24;2H"`

  bold=`echo -n -e "\033[7m"`

  norm=`echo -n -e "\033[27m"`

  ul=`echo -n -e "\033[4m"`

  noul=`echo -n -e "\033[24m"`

fi

Joe L, many thanks. Working good.

 

But on second screen (disk statistics) is not showed content of colums:

bytes-read, bytes-witen and errors

 

Can be show state of HDD activity (idle/standby/active) ?

 

Can I modify script unmenu, how?

http://lime-technology.com/wiki/index.php?title=Manage_from_Telnet

 

Or You modify this add-on, Joe L, please.

 

Thanks!

  • Author

Joe L, many thanks. Working good.

 

But on second screen (disk statistics) is not showed content of colums:

bytes-read, bytes-witen and errors

 

Can be show state of HDD activity (idle/standby/active) ?

 

Can I modify script unmenu, how?

http://lime-technology.com/wiki/index.php?title=Manage_from_Telnet

 

Or You modify this add-on, Joe L, please.

 

Thanks!

Read and Write statistics are not available from the "mdcmd" command as they were when that script was originally written.  We now need to get them from the /sys/block statistics for the disk itself.  The "name" of the parameter reporting errors also changed at some time.  It just needed to change accordingly to use rdevNumErrors instead of diskNumErrors.

 

To update the script, replace these lines

            reads[$i]=`grep "diskNumReads.$i"= /tmp/$$unmenu_status|

                    sed "s/diskNumReads.$i=//"`

            writes[$i]=`grep "diskNumWrites.$i"= /tmp/$$unmenu_status|

                    sed "s/diskNumWrites.$i=//"`

            errors[$i]=`grep "diskNumErrors.$i"= /tmp/$$unmenu_status|

                    sed "s/diskNumErrors.$i=//"`

with these new replacements:

               disk_device[$i]=`echo ${rdevname[$i]}| cut -c6-`

               writes[$i]=`cat /sys/block/${disk_device[$i]}/stat 2>/dev/null| awk '{print $5}'`

               reads[$i]=`cat /sys/block/${disk_device[$i]}/stat 2>/dev/null| awk '{print $1}'`

               errors[$i]=`grep "rdevNumErrors.$i"= /tmp/$$unmenu_status|

                       sed "s/rdevNumErrors.$i=//"`

 

Have fun...

 

Joe L.

Read and Write statistics are not available from the "mdcmd" command as they were when that script was originally written.   The "name" of the parameter reporting errors also changed.

Have fun...

 

Joe L.

 

Many thanks. All is working good.

 

 

State of HDD activity I can read from output of HDPARM.

I am try read this output from HDPARM and put it to screen menu of unmenu.

Think I right?

 

Joe L, many thanks again :)

  • Author

Read and Write statistics are not available from the "mdcmd" command as they were when that script was originally written.   The "name" of the parameter reporting errors also changed.

Have fun...

 

Joe L.

 

Many thanks. All is working good.

 

 

State of HDD activity I can read from output of HDPARM.

I am try read this output from HDPARM and put it to screen menu of unmenu.

Think I right?

 

Joe L, many thanks again :)

If you mean spinning or not, that is available in the mdcmd output. (You just need to know where to look)
If you mean spinning or not, that is available in the mdcmd output. (You just need to know where to look)

 

Yes. Spining status I can read too.  :)

  • Author

If you mean spinning or not, that is available in the mdcmd output. (You just need to know where to look)

 

Yes. Spining status I can read too.  :)

 

OK...  To add spinning status (and elapsed idle time too) you need to add a few lines

 

Immediately after these few lines:

             status[$i]=`grep "rdevStatus.$i"= /tmp/$$unmenu_status|

                     sed -e "s/rdevStatus.$i=//" -e \

                              "s/DISK_OK/OK/" -e \

                              "s/DISK_NP/Not Installed/"`

and before these lines:

             device[$i]=`grep "diskName.$i"= /tmp/$$unmenu_status|

                     sed -e "s/diskName.$i=//" -e "s/md/\\/dev\\/md/"`

 

Insert the lines shown below in bold brown:

         status[$i]=`grep "rdevStatus.$i"= /tmp/$$unmenu_status|

                   sed -e "s/rdevStatus.$i=//" -e \

                              "s/DISK_OK/OK/" -e \

                              "s/DISK_NP/Not Installed/"`

            last_io[$i]=`grep "rdevLastIO.$i"= /tmp/$$unmenu_status|

                       sed -e "s/rdevLastIO.$i=//"`

 

               if [ "${last_io[$i]}" = "0" -o "${last_io[$i]}" = ""  ]

               then

                  last_io[$i]="*"

               else

                   now=`date '+%s'`

                   seconds=$(($now-${last_io[$i]}))

                   hours=$(($seconds / 3600))

                   seconds=$(($seconds - ($hours * 3600)))

                   minutes=$(($seconds / 60))

                   seconds=$(($seconds - ($minutes * 60)))

                   last_io[$i]="$hours:$minutes:$seconds idle"

               fi

               status[$i]="${status[$i]} ${last_io[$i]}"

 

             device[$i]=`grep "diskName.$i"= /tmp/$$unmenu_status|

                     sed -e "s/diskName.$i=//" -e "s/md/\\/dev\\/md/"`

 

Working... Joe, many thanks.  :D

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.