[SOLVED] Trigger "clean shutdown" via SSH

Go to solution Solved by JonathanM,

Recommended Posts


My Unraid server runs only when needed and I wake it up via WOL.

A UPS powers Unraid server and several other hardware

One hardware watches the UPS state and once power failure occurs it initiates SSH connections to other systems and requests them to shutdown


Requirement: The Unraid server shall also be told to shutdown - but in a "clean" fashion as if was using the UI. Otherwise, the server will loose power and I'll have an "unclean shutdown" which is not cool and totally unneeded...



No idea how to do that?


It's clear that the "Shutdown" button on UI will "initiate" some code - which obviously triggers something in Unraid linux code.


I could now spend time on figuring out how to log into my Unraid server using WGET etc., then simulate I am on the UI and pressing the "Shutdown" button to trigger that. But that's pretty stupid to do as the functionallity is available "somehow".

Edited by MichaelAnders
Link to comment

Ah, cool!


For my analysis so I understand it: I can find "powerdown" in /usr/local/sbin/powerdown.


File content:

logger "/usr/local/sbin/powerdown has been deprecated"
if [[ "$1" == "-r" ]]; then
  /sbin/init 0


So basically "/sbin/init 0" is triggered, which in turns (by Linux itself) triggers "/etc/rc.d/rc.0" which then does all the magic right? Perfect!

Link to comment
  • MichaelAnders changed the title to [SOLVED] Trigger "clean shutdown" via SSH

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.

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.