Remote Shutdown of NAS server from XBMC
#1
Hello,

I have a Lacie Ethernet Disk mini (http://www.lacie.com/us/products/product.htm?pid=10844) and I currently use it to store and stream all my media from it to XBMC. Thus far, it works great.

One thing I am interested in is not having to press and hold the shutdown button for 10 seconds every time I'm done with XBMC and the NAS disk (don't want to waste energy and all, right?).

The ethernet disk has capability of remote shutdown from the administrative web pages. I've found that if I type the following address into my browser, it will shutdown the disk:

http://admin:*****@192.168.1.XXX/cgi-bin...n=shutdown

My question is, is there a way a script can be created so that I can do this from XBMC? Even better, can the script be linked to the shutdown scripts already in the XBMC?

Thanks in advance!
~Z
Reply
#2
Well, a quick look at some other posts here led me to try this:

Code:
# Shutdown Ethernet Disk Mini Server
#
# v0.1 Zach Morris
#
# Adjust admin username, password and ip_address as required


import urllib
WebSock = urllib.urlopen("http://admin:******@192.168.1.XXXX/cgi-bin/admin/reboot?action=shutdown")

Running the script from XBMC doesn't seem to do anything however Sad
Anyone have any thoughts why?

Thanks again,
~Z
Reply
#3
After looking at the Wiki, I found a solution that does work - I figured I'd post it here if anyone else has an Ethernet Disk Mini:

Code:
# Shutdown Ethernet Disk Mini Server
#
# v0.2 Zach Morris
#
# Adjust admin username, password and ip_address as required


import urllib,urllib2 , re
from string import split, replace, find

# The url in which to use
Base_URL = "http://admin:******@192.168.1.XXXX/cgi-bin/admin/reboot?action=shutdown"

# Open a 'Socket' to the URL
WebSock = urllib.urlopen(Base_URL)
# Read contents of URL
WebHTML = WebSock.read()
# Close the connection to the URL
WebSock.close()
Reply
#4
I have a Buffalo Linkstation NAS box and was interested in this, I have modified the base URL for this type of NAS box (see below). I have created it in notepad on PC....but what do I do with it now, to try it on xbox, what extension do I change the .txt to? Do I need additional files etc? Sorry complete novice with XBMC scripts. I have searched forums but can only find info' on complex python scripting.

Quote:# Shutdown Ethernet Disk Mini Server
#
# v0.2 Zach Morris
#
# Adjust admin username, password and ip_address as required


import urllib,urllib2 , re
from string import split, replace, find

# The url in which to use
Base_URL = "http://username:[email protected]/cgi-bin/setup-shutdown-in.cgi"

# Open a 'Socket' to the URL
WebSock = urllib.urlopen(Base_URL)
# Read contents of URL
WebHTML = WebSock.read()
# Close the connection to the URL
WebSock.close()

Cheers
Reply
#5
Give the text file the extension '.py'
Upload the file to the XBMC/scripts folder.
Thats it. The script should be available from the script menu in XBMC after you restart.

~Zach
Reply
#6
sipart Wrote:I have a Buffalo Linkstation NAS box and was interested in this, I have modified the base URL for this type of NAS box (see below). I have created it in notepad on PC....but what do I do with it now, to try it on xbox, what extension do I change the .txt to? Do I need additional files etc? Sorry complete novice with XBMC scripts. I have searched forums but can only find info' on complex python scripting.



Cheers

Hi mate, I also have a Linkstation, did this work ?
Reply
#7
Yes the slightly modified script works fine for Linkstation.

Pity the Linkstation doesn't support wake on lan - that would be even better.

Cheers
Reply
#8
Base_URL = "http://username:[email protected]/cgi-bin/setup-shutdown-in.cgi"


so if i put in my

username
password
url

and save it as a txt file with a .py extension it will work, surely it cannot be that easy Big Grin
Reply
#9
Yes, copy into notepad, change username,password and ip to yours and save with py extension. Drop in scripts folder and run when you want to shut nas box down. Ta
Reply
#10
sipart Wrote:Yes, copy into notepad, change username,password and ip to yours and save with py extension. Drop in scripts folder and run when you want to shut nas box down. Ta

make sure the whole script is included not just the one line ;-)
Reply
#11
This is the script I used but it does not work Huh

Says running on the screen but Linkstation does not go off



# Shutdown Ethernet Disk Mini Server
#
# v0.2 Zach Morris
#
# Adjust admin username, password and ip_address as required


import urllib,urllib2 , re
from string import split, replace, find

# The url in which to use
Base_URL = "http://admin:sh*****@192.168.2.9/cgi-bin/setup-shutdown-in.cgi"

# Open a 'Socket' to the URL
WebSock = urllib.urlopen(Base_URL)
# Read contents of URL
WebHTML = WebSock.read()
# Close the connection to the URL
WebSock.close()
Reply
#12
What model of linkstation? URL for shutdown may be different, web onto linkstation and find shutdown link and when clicked you will get some of URL in URL bar to check.

Cheers
Reply
#13
Its a Linkstation Pro

The link never changes as the menu are all generated in javascript and always say http://192.168.2.9/cgi-bin/top.cgi

After logging in you have to go Maintentance
then Shutdown
then choose Apply and then hit OK

Is yours the same ?
Reply
#14
Thanks for the tips in this thread - here's the code for any FSG users:

[code]# Shutdown Ethernet Disk Mini Server
#
# v0.2 Zach Morris
#
# Adjust admin username, password and ip_address as required


import urllib,urllib2 , re
from string import split, replace, find

# The url for a FSG
Base_URL = "http://username:[email protected]/admin/cgi-bin/shut.cgi?shutdown"


# Open a 'Socket' to the URL
WebSock = urllib.urlopen(Base_URL)
# Read contents of URL
WebHTML = WebSock.read()
# Close the connection to the URL
WebSock.close()[/code/]


Has anyone managed to get this so the script will run automatically when you shutdown XBMC?
Reply
#15
qwakuk Wrote:Its a Linkstation Pro

The link never changes as the menu are all generated in javascript and always say http://192.168.2.9/cgi-bin/top.cgi

After logging in you have to go Maintentance
then Shutdown
then choose Apply and then hit OK

Is yours the same ?

Sorry for delay in responding, i will have to check but presume the pro model is different as the modded script works with mine.

As for automated running scripts on shutdown neal37.....no idea....have you checked xbmc manual? I just add a shortcut to shutdown script in favs menu to run just before shutdown.

Cheers
Reply

Logout Mark Read Team Forum Stats Members Help
Remote Shutdown of NAS server from XBMC0