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.

[SOLVED] Commands to start and stop array

Featured Replies

Hi everyone!

 

I'm new to the forum.

 

I have three Unraid servers and remote access has become a primary goal for me recently. I can't for the life of me find the commands that I can run via SSH to start and stop the array.

 

For example I upgraded my server to 6.2 remotely and rebooted. Now I'm stuck with SSH access and in order to access the web gui I need to start Docker which needs the array to be up. One of my containers contains a proxy server that allows me to access the web gui. I'm guessing that on this server I forgot to enable "Auto Start Array"

 

Thank you for your help!

Hi everyone!

 

I'm new to the forum.

 

I have three Unraid servers and remote access has become a primary goal for me recently. I can't for the life of me find the commands that I can run via SSH to start and stop the array.

 

For example I upgraded my server to 6.2 remotely and rebooted. Now I'm stuck with SSH access and in order to access the web gui I need to start Docker which needs the array to be up. One of my containers contains a proxy server that allows me to access the web gui. I'm guessing that on this server I forgot to enable "Auto Start Array"

 

Thank you for your help!

Start:

wget -qO /dev/null http://localhost:$(lsof -nPc emhttp | grep -Po 'TCP[^\d]*\K\d+')/update.htm?cmdStart=Start

 

Stop:

 

wget -qO /dev/null http://localhost:$(lsof -nPc emhttp | grep -Po 'TCP[^\d]*\K\d+')/update.htm?cmdStop=Stop

Start:

wget -qO /dev/null http://localhost:$(lsof -nPc emhttp | grep -Po 'TCP[^\d]*\K\d+')/update.htm?cmdStart=Start

 

Stop:

 

wget -qO /dev/null http://localhost:$(lsof -nPc emhttp | grep -Po 'TCP[^\d]*\K\d+')/update.htm?cmdStop=Stop

 

Yikes!  Probably works though.  Might want to appeal to Tom for a return to the simpler mdcmd commands.

Start:

wget -qO /dev/null http://localhost:$(lsof -nPc emhttp | grep -Po 'TCP[^\d]*\K\d+')/update.htm?cmdStart=Start

 

Stop:

 

wget -qO /dev/null http://localhost:$(lsof -nPc emhttp | grep -Po 'TCP[^\d]*\K\d+')/update.htm?cmdStop=Stop

 

Yikes!  Probably works though.  Might want to appeal to Tom for a return to the simpler mdcmd commands.

Eric gave them to me for another plugin thats fallen by the wayside.  Its just hitting the webUI to do it.  There is no "command" per se to accomplish starts and stops

Start:

wget -qO /dev/null http://localhost:$(lsof -nPc emhttp | grep -Po 'TCP[^\d]*\K\d+')/update.htm?cmdStart=Start

 

Stop:

 

wget -qO /dev/null http://localhost:$(lsof -nPc emhttp | grep -Po 'TCP[^\d]*\K\d+')/update.htm?cmdStop=Stop

 

Yikes!  Probably works though.  Might want to appeal to Tom for a return to the simpler mdcmd commands.

Eric gave them to me for another plugin thats fallen by the wayside.  Its just hitting the webUI to do it.  There is no "command" per se to accomplish starts and stops

I think there used to be, long ago, something very simple like 'mdcmd start' and 'mdcmd stop'...

I think there used to be, long ago, something very simple like 'mdcmd start' and 'mdcmd stop'...

This day and age there is a ton of other services (docker, vms) that need to be started / stopped that the basic array commands (mdcmd) do not take into consideration.  Hence all the bugaboo going on with a replacement for powerdown now.
  • Author

Start:

wget -qO /dev/null http://localhost:$(lsof -nPc emhttp | grep -Po 'TCP[^\d]*\K\d+')/update.htm?cmdStart=Start

 

Stop:

 

wget -qO /dev/null http://localhost:$(lsof -nPc emhttp | grep -Po 'TCP[^\d]*\K\d+')/update.htm?cmdStop=Stop

 

Awesome it works! Never though to do it this way! Thank a bunch!

;D

  • 2 years later...

I know this is a very old thread.  Will this work if array is encrypted?  How to mount encrypted array

 

8 hours ago, bphillips330 said:

I know this is a very old thread.  Will this work if array is encrypted?  How to mount encrypted array

That command basically pushes the stop array button.  So no reason why encryption would make a difference either way

 

Is there a "start" button so to speak. and a spot to put in encryption key from the cli?

No there isn't.  You would have to say have the array autostart and utilize a key file from somewhere in order to accomplish this.  Don't use encryption, so can't particularly help.

  • 8 months later...

If the webgui is corrupted (have an open thread) is there a way to manual start the array that does not invoke the GUI?

  • 6 months later...
On 9/1/2019 at 5:55 PM, J.Nerdy said:

If the webgui is corrupted (have an open thread) is there a way to manual start the array that does not invoke the GUI?

I second that question!

I have 500 Internal error on time to time so have to do a host reset, which lead on a parity check after restart...

  • 1 year later...

what parameter would I need to add to that command if my drives are with a passphrase? 

20 minutes ago, brianvicente said:

what parameter would I need to add to that command if my drives are with a passphrase? 

Not possible

  • Community Expert
8 hours ago, brianvicente said:

what parameter would I need to add to that command if my drives are with a passphrase? 

a file called keyfile is created so you can create before running the command. File is in /root and it is called keyfile. 

 

I get the file via ftp from another device i.e. Raspberry PI to allow autostart in my go.

 

# Start the Management Utility
wget --ftps-implicit --user=pi  --password='raspberry' ftp://x.x.x.x/files/keyfile -O /root/keyfile

 

  • 3 years later...
  • Community Expert

7.1.4 1 line terminal command to stop the array... As if you hit the stop button on the main tab

stop array:

CSRF=$(grep -Po '^csrf_token="\K[^"]+' /var/local/emhttp/var.ini)
# try HTTP first
curl -sS -k --fail -e "http://localhost/Main" \
  -c /tmp/unraid.cookies -b /tmp/unraid.cookies \
  --data "startState=STARTED&file=&csrf_token=${CSRF}&cmdStop=Stop" \
  http://localhost/update.htm || \
# fallback to HTTPS
curl -sS -k --fail -e "https://localhost/Main" \
  -c /tmp/unraid.cookies -b /tmp/unraid.cookies \
  --data "startState=STARTED&file=&csrf_token=${CSRF}&cmdStop=Stop" \
  https://localhost/update.htm

stat array:

CSRF=$(grep -Po '^csrf_token="\K[^"]+' /var/local/emhttp/var.ini)

curl -sS -k --fail -e "http://localhost/Main" \
  -c /tmp/unraid.cookies -b /tmp/unraid.cookies \
  --data "startState=STOPPED&file=&csrf_token=${CSRF}&cmdStart=Start" \
  http://localhost/update.htm || \
curl -sS -k --fail -e "https://localhost/Main" \
  -c /tmp/unraid.cookies -b /tmp/unraid.cookies \
  --data "startState=STOPPED&file=&csrf_token=${CSRF}&cmdStart=Start" \
  https://localhost/update.htm

*ASUMES A VALD ARRAY CONFIG!!!

Verify and check:
root@The-Borg:~# grep -E '^(mdState|fsState)=' /var/local/emhttp/var.ini

mdState="STARTED"

fsState="Started"

root@The-Borg:~#

Why these parameters? Because the GUI’s JS adds a hidden cmdStop=Stop input and posts to /update.htm with csrf_token, plus a startState field (STARTED when stopping, STOPPED when starting) and an empty file param. Community-confirmed payloads (worked for others when GETs failed):

  • 4 weeks later...

If my array is stuck in the stopping state (been 12 hours now since I tried to stop it), am I at risk of data loss if I force a reboot?

:~# grep -E '^(mdState|fsState)=' /var/local/emhttp/var.ini

mdState="STARTED"

fsState="Stopping"

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

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.