|
SageTV Media Extender Discussion related to any SageTV Media Extender used directly by SageTV. Questions, issues, problems, suggestions, etc. relating to a SageTV supported media extender should be posted here. Use the SageTV HD Theater - Media Player forum for issues related to using an HD Theater while not connected to a SageTV server. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
HOW-TO: Shutdown your MVP remotely
I have seen where several people have wanted the ability to shut down their MVP remotely. There is a add-on that is supposed to act as a sleep function, but I did not have much luck with it. And, it still does not provide an "on demand" way of doing it.
There are a few ways this can be done. Some are cleaner than others. If you haven't yet, try telnetting to your MVP with the command "telnet ip.addr.of.mvp" from a DOS prompt. You will be greeted with a login prompt. Code:
Welcome to MediaMVP! (none) login: Code:
Welcome to MediaMVP! (none) login: root BusyBox v1.2.2 (2006.11.10-19:12+0000) Built-in shell (ash) Enter 'help' for a list of built-in commands. ~ # Back to our topic... There are a couple commands that look promising, namely "halt" and "reboot". While reboot will do just that to the MVP, if your goal is an off state, it won't work. Halt will shut it down, but you will need to remove the power cable for a few seconds to get it going again, not very handy. So, let's dig a little bit further... Looking at running processes reveals some that look interesting "/sagetv/miniclient"...: Code:
~ # ps PID Uid VmSize Stat Command 1 root 144 S init 2 root SWN [ksoftirqd/0] 3 root SW< [events/0] 4 root SW< [khelper] 5 root SW< [kthread] 12 root SW< [kblockd/0] 30 root SW [pdflush] 31 root SW [pdflush] 33 root SW< [aio/0] 32 root SW [kswapd0] 68 root 68 S init 69 root 216 S /bin/sh /etc/rcS 96 root 160 R /sbin/udhcpc -f -i eth0 -p /tmp/udhcpc.pid 99 root Z [telnetd] 100 root 116 R /usr/sbin/telnetd 121 root Z [miniclient] 122 root Z [miniclient] 123 root Z [miniclient] 124 root Z [miniclient] 133 root 4992 S /sagetv/miniclient 10.254.254.2 134 root 4992 S /sagetv/miniclient 10.254.254.2 135 root 4992 R /sagetv/miniclient 10.254.254.2 136 root 4992 S /sagetv/miniclient 10.254.254.2 137 root 4992 S /sagetv/miniclient 10.254.254.2 139 root 268 S -sh 140 root 164 R ps ~ # Code:
~ # killall miniclient ~ # Success! And we can power it back up with the power button on the remote. So, in short, if someone wants to remotely shut down the MVP in the kids room, bedroom or whatever, simply telnet to it and issue the command "killall miniclient" and you will be rewarded with success. This can be drawn upon further with some creativity to automate shutting the MVP down at a certain time or a number of other possibilities. If others want to go deeper into how to use something like expect to script it and run int on a schedule, we can discuss that as well if the demand or interest is there. There could be some effect on the Sage server from the client just disappearing, but I doubt it. |
#2
|
||||
|
||||
Just tried this. It works great. I've been looking for a way to do this or a while.Thaks.
|
#3
|
|||
|
|||
I was doing some more digging, and I took a look at the init script /etc/rcS and found some things that could be helpful:
Code:
/etc # cat rcS #!/bin/sh /bin/mount /proc /bin/mount -t sysfs sysfs /sys /sbin/ifconfig lo 127.0.0.1 # Default to finding server address SERVER="0.0.0.0" NICTYPE="0" eval `/sagetv/mvpnet` /sbin/ifconfig eth0 up insmod /lib/modules/os_core.ko insmod /lib/modules/av_core.ko insmod /lib/modules/ircombo.ko insmod /lib/modules/smallgfx.ko mount -t ramfs /dev/ram1 /tmp if [ "$NICTYPE" -eq "0" ]; then echo Wired mode /sbin/udhcpc -f -i eth0 -p /tmp/udhcpc.pid & else echo Wireless mode e:$ESSID w:$WEP k:$KEY m:$MODE insmod /wireless/firmware_class.ko insmod /wireless/pcmcia_core.ko insmod /wireless/pcmcia.ko insmod /wireless/acx.ko insmod /wireless/mvp_cf.ko /bin/sleep 5 # Needed for carrier... CARRIER=`/bin/cat /sys/class/net/eth0/carrier` if [ "$CARRIER" -eq "1" ]; then /sbin/udhcpc -f -i eth0 -p /tmp/udhcpc.pid & else NEWMAC=`cat /sys/class/net/eth0/address | awk -F : '{printf "%s:%s:%s:%s :%s:%02x\n", $1, $2, $3, $4, $5, strtonum("0x"$6)+1}'` /sbin/ifconfig wlan0 hw ether $NEWMAC /wireless/iwconfig wlan0 essid $ESSID /wireless/iwconfig wlan0 sens 3 if [ "$WEP" -eq "1" ]; then /wireless/iwconfig wlan0 key $KEY /wireless/iwconfig wlan0 key on fi if [ "$MODE" -eq "0" ]; then /wireless/iwconfig wlan0 mode ad-hoc else /wireless/iwconfig wlan0 mode managed fi /sbin/udhcpc -f -i wlan0 -p /tmp/udhcpc.pid & fi fi /usr/sbin/telnetd while [ ! -f /tmp/lan ]; do echo Waiting for lan sleep 1 done while [ "1" = "1" ]; do /sagetv/ledtest 1 /sagetv/mvppower 1 if [ "$SERVER" == "0.0.0.0" ]; then IP=`/sagetv/miniclient` else IP=$SERVER # Run this to clear the screen /sagetv/miniclient fi /sagetv/miniclient $IP 2>&1 > /dev/null powerdown=$? if [ "$powerdown" -ge 1 ] then /sagetv/ledtest 0 /sagetv/mvppower 0 /sagetv/mvpwait fi done Of particular interest is the last if statement: Code:
if [ "$powerdown" -ge 1 ] then /sagetv/ledtest 0 /sagetv/mvppower 0 /sagetv/mvpwait fi Specifically, Code:
powerdown=1 /etc/rcS Update: I slipped in doing this during a commercial. It appears that it will just restart it. But, I think I can work up a command to do this more cleanly than just killing them. "/sagetv/mvppower 0" doesn't work as expected. So, there is still more reasearch to do. I may see if I can get one of the lower level linux hackers at work to take a look and see what they can do with it. |
#4
|
|||
|
|||
How about a sleep timer for the MVP clients?
Then I guess the next step would be the TV. How to shut it down after the MVP goes off. Some TVs may do this after a signal loss for a period of time, but some won’t. Or is this already available. I have not updated to 6 yet. |
#5
|
|||
|
|||
Have you checked out flachbar's sleep timers? The original, http://forums.sagetv.com/forums/showthread.php?t=16310 , is configurable in many way to sleep in a set time period, or to turn off at a sertain time. It even has the ability to send IR commands to a usb-uirt (to turn off the tv?) when going to sleep. I dunno if it will work with the MVP, when Dirk was doing the main work on it, it doesn't look like he had an MVP.
Then there is his MVP auto-sleep timer, http://forums.sagetv.com/forums/show...34&postcount=9 , that will auto sleep the MVP, or a SageClient, if there aren't any keypresses in a set time, such as 2 hours. It is currenly only for SageMC usage, but it is on his to-do list to adapt it to the default UI.
__________________
- Jack __________________________________________ Server: AMD Phenom 9750, 2GB RAM, 2 Hauppauge PVR500, 1 Firewired DCT6200, 1 HDHomerun tuning 2 QAM channels, Vizio 37" HDTV LCD, 1 USB-UIRT Clients: 1 MediaMVP, 1 Placeshifter Client, & 1 SageTV Client. |
#6
|
|||
|
|||
Thanks for the info, I will have to check them out.
|
#7
|
||||
|
||||
I have added a button to remotely shutdown or reboot a connected MVP to the 2.17 version of my webserver. Thanks for investigating and finding this.
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki |
#8
|
|||
|
|||
So all this is possible, yet no-one has found a way yet to send a wake-on-lan package from the MVP to power up the SageTV server?
|
#9
|
|||
|
|||
Do you know of a WOL package which will run on the MVP?
B |
#10
|
|||
|
|||
On my linux server (which I can access from anywhere) I have a package called "wakeonlan" that I installed as an RPM which I use to wake up the SageTV server. You type "wakeonlan <MAC address of Sage server>" and of it goes...
The MVP being a linux box, one should be able to run it, but something like RPM doesn't exist on it of course... |
#11
|
|||
|
|||
Here is a VERY small Java program that I found that should work... I think it would need to be built-in to the SAGE MVP software.
__________________
unRaid Server:Quad-Core Xenon, 20 GB Ram, openDCT/sageTV Dockers, HDHR,HDHR Prime Network Encoder:Dell Inspiron 1000 Laptop, 512MB Ram, Windows XP, HDPVR |
#12
|
|||
|
|||
#13
|
|||
|
|||
__________________
unRaid Server:Quad-Core Xenon, 20 GB Ram, openDCT/sageTV Dockers, HDHR,HDHR Prime Network Encoder:Dell Inspiron 1000 Laptop, 512MB Ram, Windows XP, HDPVR |
#14
|
|||
|
|||
ehmmm..... it looks like there's no java on the MVP to run this
|
#15
|
|||
|
|||
You can't do WOL for the Sage server from the MVP. Since it needs the sage server to boot, you wont be able to run your WOL app until the Sage box is up. I believe that all the MVP has on it natively is a simple bootstrap loader to get the OS from the server.
|
#16
|
|||
|
|||
I don't think that is true, because Linux will simply boot up once you start up the MVP. It loads the graphical shell from the server, but the basic linux system is hardcoded into the MVP. The problem would be to add extra code and have it saved, but I figure that as long as it is only turned of with the remote (soft turn off) it should remember the extra code.
But I'm just guessing. |
#17
|
|||
|
|||
Should be easy enough to test, if you can telnet to it when it is in the "no streaming server found" state.
|
#18
|
|||
|
|||
The real issue is that you have to put the mod (whatever it is) on the box every time it is started up. If you're cool with that (I am sure you can script a telnet session or something) then consider using the power on event to poke your linux server with ping. When the port is triggered it kicks of the WOL. A low cost server for this would be the Buffalo routers all the DDWRT and Tomato guys love.
Put your WOL poke after Code:
while [ ! -f /tmp/lan ]; do echo Waiting for lan sleep 1 done B |
#19
|
|||
|
|||
Hang on, slow I'm not that good with coding and programming...
What you're saying is: use the linux server with the wakeonlan software to do the actual WOL? And have the MVP trigger the linux server to start the wol That doesn't sound too bad! The fact that the MVP will loose any extra code when completely shut down is not a big issue to start with. My MVPs are usually on anyways, so they will keep the code and when I hit ON on the remote it should trigger the linux box... So I get the idea, but the actual coding....? And yeah: you can still telnet to it when the Sage server is down, I tested that. Don't know what it does when it is in the "Failed to locate GUI server" state, but that's not really relevant, I want to use this after a successfull startup when the Sage server has gone into standby (I have it do that after 15 minutes of inactivity). Oh, sorry for the hijack |
#20
|
|||
|
|||
WOL is actually a BIOS function. While you should be able to do it with your server as the target, you won't be able to wake the MVP. A work around might be to hook the MVP to an X10 outlet.
- joat |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
MVP and Powerline Networking: Incompatible? | mdnttoker | SageTV Media Extender | 24 | 11-07-2007 12:11 AM |
Hauppauge Media MVP problem | tktplz | SageTV Media Extender | 9 | 03-01-2007 03:31 PM |
SageTV software with Hauppage MVP problems continued | dbritton | SageTV Media Extender | 4 | 11-07-2006 06:59 AM |
Problem with reconnecting MVP after shutdown | RalfH | SageTV Media Extender | 4 | 03-09-2006 11:31 PM |
MVP Never Progresses past "Starting Application" | MrApollinax | SageTV Media Extender | 49 | 01-03-2006 04:25 PM |