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.

Shutdown unraid with curl

Featured Replies

Hi Guys,

 

I'm trying to shutdown unraid via curl, so I can do a proper shutdown in the terminal. The main reason I want to do this is that I want to shutdown my server with Google Home. After reading here that there is no completely clean way to do this directly from the terminal I figured why not just press the shutdown button in the webinterface. I already tried instructions from unraid v5 (see link) however this did not work for me.

 

These are the commands I tried:

curl -u root:<password> http://<server-ip>/update.htm?shutdown=apply

curl -u root:<password> http://<server-ip>/webGui/include/Boot.php

 

 

 

 

Any advice is greatly appreciated. 

 

Hi Guys,
 
I'm trying to shutdown unraid via curl, so I can do a proper shutdown in the terminal. The main reason I want to do this is that I want to shutdown my server with Google Home. After reading here that there is no completely clean way to do this directly from the terminal I figured why not just press the shutdown button in the webinterface. I already tried instructions from unraid v5 (see link) however this did not work for me.
 
These are the commands I tried:
curl -u root: http:///update.htm?shutdown=apply
curl -u root: http:///webGui/include/Boot.php
 
 
 
 
Any advice is greatly appreciated. 
 
Remind me tomorrow. Since I've already read the thread, I'll forget about it

Sent from my NSA monitored device

  • Author

Thanks Squid, I tried a few different things now, however I only got the one in the thread you linked working:

<?
$vars = parse_ini_file("/var/local/emhttp/var.ini");
exec('wget -qO /dev/null  "http://localhost:80/update.htm?cmdStop=Stop&csrf_token='.$vars['csrf_token'].'"');
?>

 

When I tried to adapt to the shutdown command none of these approaches worked:

<?
$vars = parse_ini_file("/var/local/emhttp/var.ini");
exec('wget -qO /dev/null  "http://localhost:80/update.htm?shutdown=apply&csrf_token='.$vars['csrf_token'].'"');
?>
<?
$vars = parse_ini_file("/var/local/emhttp/var.ini");
exec('wget -qO /dev/null  "http://localhost:80/update.htm?cmdShutdown=Apply&csrf_token='.$vars['csrf_token'].'"');
?>
<?
$vars = parse_ini_file("/var/local/emhttp/var.ini");
exec('wget -qO /dev/null  "http://localhost:80/update.htm?shutdown=shutdown&csrf_token='.$vars['csrf_token'].'"');
?>

 

I think my main issue at this point is, that I don't know how to find out which command corresponds to shutting down. Is there any chance to find that out?

 

 

 

  • 2 weeks later...
  • Author

Okay, so I looked at this again today. I specifically found this:

function stopArray(form) {
  $(form).append('<input type="hidden" name="cmdStop" value="Stop">');
  swal({title:'Proceed?',text:'This will stop the array',type:'warning',showCancelButton:true},function(p){if (p) form.submit(); else $('input[name="cmdStop"]').remove();});
}
function stopParity(form,text) {
  $(form).append('<input type="hidden" name="cmdNoCheck" value="Cancel">');
  swal({title:'Proceed?',text:'This will stop the running '+text+' operation',type:'warning',showCancelButton:true},function(p){if (p) form.submit(); else $('input[name="cmdNoCheck"]').remove();});
}
function pauseParity(form) {
  $(form).append('<input type="hidden" name="cmdNoCheck" value="Pause">');
  $('#pauseButton').val('Resume').prop('onclick',null).off('click').click(function(){resumeParity(form);});
  form.submit();
}
function resumeParity(form) {
  $(form).append('<input type="hidden" name="cmdCheck" value="Resume">');
  $('#pauseButton').val('Pause').prop('onclick',null).off('click').click(function(){pauseParity(form);});
  form.submit();
}
function shutdown_now(form,cmd) {
  $(form).append('<input type="hidden" name="cmd" value="'+cmd+'">');
  swal({title:'Proceed?',text:'This will '+cmd+' the system',type:'warning',showCancelButton:true},function(p){if (p) form.submit(); else $('input[name="cmd"]').remove();});
}
function toggleApply(checked) {
  $('input[name="#apply"]').prop('disabled',!checked);
}

All commands that do not lead into an confirmation can just be called like this for example:

http://192.168.178.5:80/update.htm?cmdStop=Stop&csrf_token=<insert_token_here>


However as soon as I try to click, let's say the shutdown button I think the WebUI shows the apply button. Is there any way to directly call the apply button, or how would I proceed at this point?

  • Community Expert

I would have thought that a solution that issued the ‘powerdown’ command at the CLI level would be the easiest way to do this?

WTF Hack: append line into /etc/password for a new user with the shell set to /sbin/shutdown this way whenever that user logs in the system will shutdown. 🤣

 

11 hours ago, BRiT said:

WTF Hack: append line into /etc/password for a new user with the shell set to /sbin/shutdown this way whenever that user logs in the system will shutdown. 🤣

 

Can you do it with root user? 😱

  • Author

Ouch. Okay thanks to all from preventing me to waste even more time on this 😅

So what is exactly the difference between the "powerdown" and "shutdown -h now" command?

I used to use the "shutdown" command but it almost always lead to unclean shutdowns, so I guess "powerdown" triggers all the routines to bring the array to a stop correctly. Is there any more to that?

  • Community Expert
5 hours ago, Fenix said:

Ouch. Okay thanks to all from preventing me to waste even more time on this 😅

So what is exactly the difference between the "powerdown" and "shutdown -h now" command?

I used to use the "shutdown" command but it almost always lead to unclean shutdowns, so I guess "powerdown" triggers all the routines to bring the array to a stop correctly. Is there any more to that?

Powerdown is Unraid specific and triggers the same processing as using the Powerdown button from the GUI.    The shutdown command is a Linux command that can bypass many of the steps that powerdown runs.

  • 4 years later...

Hello,

 

is there a solution to this available now? I want to sleep or shutdown my UNRAID instance using Shortcuts in iOS.

For that I can either use a CURL command or a SSH command.

 

Thanks!

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.