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 the unraid tower via XBMC ?

Featured Replies

Is there a possibility that you can send a command via the xbmc (Pyton script?) that will stop the server and shut the server down..?

 

thanks

  • 6 months later...

Bump!

I'm quite interesed in that function.

Does anyone has an idea on how to do this?

Either send a telnet script from python or sending the HTTP stop & shutdown commands?

There's nothing about python script on those pages or am I missing something?

Nope, no pythons!  If you can't 'Run a Command', TST10.EXE, then I would look into WeeboTech's SpinControl work, and see if you can find a NetCat or equivalent to talk to his scripts.

Oh Geeze, I thought XBMC was a windows environment.

If it's a linux environment then you can use my powerdown script and call it via tcpip socket call by installing spincontrol.

 

I really hope to change all this around.

I'll rework the spin control to be unraidcd (unraid control daemon) and re-write it in C.

It will then let me do all sorts of things with a plugin mechanism.

It'll be sort of a RPC agent. (and it just so happens I'm learning about XMLRPC).

 

Another choice is to install ssh, and have a script call ssh with a remote command.

 

Last but not least, it is entirely possible to write direct http calls.

 

I've done this in perl with the LWP library.

I've also done it in TCL The TCL project was cool, it;s an IRC bot that gathers infomration from the channel, builds an HTML page, Uploads it via a PHP capture script.

 

So it's all do-able, it just depends on how you want to do it.

 

I don't know python, so I cannot help you there.. Just too many scripting languages and I refused to learn it.

 

Hey guys!

With the help of alexsolex & Temhil on passionxbmc's forum I managed to build a working python script using telnet to safely shutdown the unraid box :D

import sys
import telnetlib

HOST       = "XXX.XXX.XXX.XXX"
login        = "login"
password  = "password"

print "####################################################################"
print
print "                         unRAID poweroff script"
print
print "####################################################################"

tn = telnetlib.Telnet(HOST)

# Set debug infos - Uncomment this line in order to display Telnet debug info in the log
#tn.set_debuglevel(5)

tn.read_until("Tower login:")
print("Entering Login")
tn.write(login + "\r")
print("login:  PASSED")
print("-------------------------------------")

tn.read_until("Password:")
print("Entering password")
tn.write(password + "\r")
print("password:  PASSED")
print("-------------------------------------")

print("Stopping the array")
tn.write("stop\r")
tn.read_until("cmdResult=ok")
print("Array stopped")
print("-------------------------------------")

print("Powering down the server")
tn.write("poweroff\r")
print("unRAID server down")
print("-------------------------------------")

tn.write("exit\r")
# read the logon message up to the prompt
print tn.read_all() 
print("-------------------------------------")
print "################################END#################################"

 

Of course it has to be tweaked and you need to fill the following details :

IP of the box

Login

Password

As well as the first "tn.read_until" if you changed the "Tower" name of your unRAID box.

 

We also managed to have a script using the http commands which is much more simple & lighter (although size is really not the issue here) but is less secure as we didn't found a safe way to know when the server is ready to be turned off; when the spinup is complete & so on, do you know a way to check with http protocol if the array's been stopped or not?

Anyway, it's not that important as the telnet script works really well and allows much more options :)

 

With this step I'm seriously considering the move of the unRAID box to my basement, connected only to a power & gigabit ethernet cable :)

 

P.S. : A wake on lan script already exists for xbmc ;)

Samba should be stopped before stopping the array.

 

/etc/rc.d/rc.samba stop

 

 

Also what happens if you change this line

tn.read_until("Tower login:")

to

tn.read_until(" login:")

 

The hostname may not matte if this works.

Also what happens if you change this line

tn.read_until("Tower login:")

to

tn.read_until(" login:")

 

The hostname may not matte if this works.

Indeed, this should be better :)

 

As for stopping samba isn't that taken care by the "stop" command?

With this step I'm seriously considering the move of the unRAID box to my basement, connected only to a power & gigabit ethernet cable

 

PLEASE don't forget to add a UPS to that list...  :o

 

 

As for stopping samba isn't that taken care by the "stop" command?

NO, it's like pulling out the disks from under a running program.

 

The correct way to stop unraid is

samba stop

sync # the drives

Kill active processes on the partitions

unmount the drives

stop the array

then poweroff.

 

The mechanism used in the script works, but may trigger a rebuild of parity on reboot.

or if there are processes left on the /mnt/disk? mounts, may trigger a filesystem check on boot.

 

  • 4 weeks later...

Hey guys!

With Temhill's help from XBMC Passion's website I managed to create a new script which uses WebooTech & RobJ's powerdown script to safely powerdown the unRAID box via XBMC's python script.

WebooTech, RobJ, I add your script to the zip file, I hope you don't mind. Of course all the credit goes to you in the readme ;)

By the way, as it's my very first release I may have done some mistakes in credits or format of the readme. If it needs corrections don't hesitate to let me know :)

 

Damn! Attachment limit is 128KB & the zip is 150KB :-\

You can download it from here

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.