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] Trigger "clean shutdown" via SSH

Featured Replies

Background:

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

 

Problem:

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

Solved by JonathanM

  • Author

Ah, cool!

 

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

 

File content:

#!/bin/bash
logger "/usr/local/sbin/powerdown has been deprecated"
if [[ "$1" == "-r" ]]; then
  /sbin/reboot
else
  /sbin/init 0
fi

 

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!

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

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.