|
# ethtool eth0
Settings for eth0: Supported ports: [ TP MII ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full Advertised auto-negotiation: Yes Speed: 100Mb/s Duplex: Full Port: MII PHYAD: 1 Transceiver: internal Auto-negotiation: on Supports Wake-on: pumbg Wake-on: d Current message level: 0x00000001 (1) Link detected: yes |
| # ethtool -s eth0 wol g |
|
apt-get install wakeonlan
|
| #! /bin/sh # MAC address of backend SERVER_MAC=xx:xx:xx:xx:xx:xx # case "$1" in start) # Issue wakeonlan at intervals until our own network interface # is active and the magic packet is successfully sent. # until /usr/bin/wakeonlan $SERVER_MAC > /dev/null 2>&1 ; do sleep 1 done ;; *) esac exit 0 |
|
$ chmod +x /etc/init.d/wol
$ update-rc.d wol defaults
|
|
exec /usr/bin/mythfe.sh &
|
|
/usr/bin/mythfestart.sh:
#! /bin/bash # IP address of backend SERVER_IP=xxx.xxx.xxx.xxx # SERVER_MAC=xx:xx:xx:xx:xx:xx # Could optionally send a wakeup packet here, if # a) it is decided that the early-running script above is not needed, or # b) to cover the rare case that backend was shutting down when first one sent # # Use mythTV status port as backend connectivity test until [ -n "`telnet $SERVER_IP 6544 |grep -i connected`" ]; do sleep 3 done # start frontend mythfrontend & exit 0 |
Remark: this is only for a dedicated Backend system. Not Combined MBE/FE setup.
On the MBE you'll need to make some changes for shutting down the server but allso, see if any planned schedules are comming up and when to shutdown and wakeup the MBE. The easiest way is to use ACPI and therefor we'll need to make sure our BIOS supports this, and you can see this information in your kernel.log file:
|
$ grep -i rtc /var/log/kern.log
RTC can wake from S4 ... rtc0: alarms up to one month |
This tells us, that the MBE can be wake up from S4 state and therefor a timestamp can be written. Here's my problem - I cannot use this! since my MBE only supports alarms up to one day.
Disabling the hardwareclock on Debian, is quite easy. Add the following line to the file /etc/default/rcS
|
HWCLOCKACCESS=no
|
Now the machine are ready to configure MythTV - to use our setups.
Select the backend's "General" options and on the "Shutdown/Wakeup Options" page, make the following settings:
The create the script /usr/bin/setwakeup.sh and add these lines:
| #!/bin/bash echo $1 > /tmp/wakeup.txt echo "shutdown from mythtv will wake up at $@" >> /var/log/mythtv/mythbackend.log scp /tmp/wakeup.txt root@ROUTERIP:/tmp/wakeup.txt exit 0 # EOF |
Change the permission on the script:
| $ chmod +x /usr/bin/setwakeup.sh |
and add the lines for the user mythtv using visudo command:
| %mythtv ALL = NOPASSWD: /sbin/shutdown, /bin/sh, /usr/bin/setwakeup.sh |
This will allow our myth user to make the changes etc during shutdown of the MBE. Now you're ready to use MythTV but saving power at the same time!
On the Router I did added the follwinging files:
/usr/bin/wakebackend.sh
|
now11=`date "+%Y%m%d%H%M"` |
/usr/bin/wakecore.sh
|
#!/bin/bash wakeonlan 00:24:E8:43:C0:10 # EOF |
And added a crontabjob - like this:
| */2 * * * * /usr/bin/wakebackend.sh |
This gives me a usage for powersaving - but allso waking up my Backend from but timescheduled recordings, or whenever a frontend is tuned on somewhere in my house! :-) MISSA Like!!!!