[Request] Ubuntu Remote Shutdown Skript..
#1
...i think the title sais it all...

i need a skript that shuts down my ubuntu media server over LAN...

thank you for your help!
Reply
#2
There is a thread that explains how to do it via webserver.
However you can do it with EventServer. tools/EventClients/examples/python/example_action.py and just add XBMC.Quit() as argument.

You will need to alter the IP in the file however
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#3
Actually, have been meaning to make that script as a real client for quite some time and you pushed me into doing it Smile

wget https://xbmc.svn.sourceforge.net/svnroot...mc-send.py

Not sure it will make it into babylon though but just download it and run with python xbmc-send.py --help
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#4
thx i will try it
Reply
#5
maybe thats a really stupid question but..

how do i run the script on the xbox with "python xbmc-send.py --help"

O_o
Reply
#6
umm SSH into it then 'shutdown now', why need a script?
Reply
#7
Masternoob Wrote:maybe thats a really stupid question but..

how do i run the script on the xbox with "python xbmc-send.py --help"

O_o

You don't, you run it on the other computer.
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#8
Topfs2 Wrote:You don't, you run it on the other computer.
an how do i shutdown the server from the xbox then?

PainToad Wrote:umm SSH into it then 'shutdown now', why need a script?

Huh
Reply
#9
There was a reason I told you to run python xbmc-send --help ...
But since apparently we need to spoonfeed here is the output from the help.

Code:
python xbmc-send.py --help
xbmc-send [OPTION] --action=ACTION
Example
    xbmc-send --ip=192.168.0.1 --p 9777 --action="XBMC.Quit"
Options
    --help, -h.            Will bring up this message
    -i IP, --ip=IP.            Choose what IP to connect to (default=localhost)
    -p PORT, --port=PORT.        Choose what PORT to connect to (default=9777)

Surely this must be enough to get you started.

Cheers,
Tobias
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#10
ok maybe im really stupid or you dont understand what i want to do... Confused

but...how should the line
Code:
xbmc-send --ip=whatever --p 9777 --action="XBMC.Quit"

shut down UBUNTU over lan?
xbmc is not running on the server....its only a fileserver...
Reply
#11
I have missunderstood you request completely, I believe you wanted to turn off your XBMC HTPC which runs on ubuntu. SO it's me who is stupid Big Grin

Sorry, if you want to turn of your server from xbox I have no clue how to do it. And I can understand you got confused by me Big Grin I'm really sorry Smile

However you can as Paintoad said just ssh in to your ubuntu server from putty, or another linux machine.
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#12
Topfs2 Wrote:I have probably missunderstood you request completely, I believe you wanted to turn off your XBMC HTPC which runs on ubuntu.

Sorry, if you want to turn of your server from xbox I have no clue how to do it.

However you can as Paintoad said just ssh in to your ubuntu server from putty, or another linux machine.
is it possible to ssh with python? O_o

€: ok after a lot of research i found this:

Code:
from subprocess import Popen, PIPE

shutdown = Popen(['echo', 'shutdown', '-h', 'now'], stdout=PIPE)
ssh = Popen(['ssh', '[email protected]'], stdin=shutdown.stdout, stdout=PIPE)
ssh.communicate()

but it doesnt work =/

has someone an idea?
Reply
#13
Masternoob Wrote:is it possible to ssh with python? O_o

€: ok after a lot of research i found this:

Code:
from subprocess import Popen, PIPE

shutdown = Popen(['echo', 'shutdown', '-h', 'now'], stdout=PIPE)
ssh = Popen(['ssh', '[email protected]'], stdin=shutdown.stdout, stdout=PIPE)
ssh.communicate()
but it doesnt work =/

has someone an idea?
popen won't work on xbox xbmc, sorry.
you can use the depreciated os.system instead. Google or see the python docs on how to do this.
Always read the XBMC online-manual, FAQ and search and search the forum before posting.
For troubleshooting and bug reporting please read how to submit a proper bug report.

If you're interested in writing addons for xbmc, read docs and how-to for plugins and scripts ||| http://code.google.com/p/xbmc-addons/
Reply
#14
rwparris2 Wrote:popen won't work on xbox xbmc, sorry.
you can use the depreciated os.system instead. Google or see the python docs on how to do this.


Code:
import os
os.system('echo shutdown -h now | ssh [email protected]')

i put this in a shutdown.py file, and started it on my xbox...but it doesnt work No
Reply

Logout Mark Read Team Forum Stats Members Help
[Request] Ubuntu Remote Shutdown Skript..0