Wakeonlan boot script help
#16
you might be much better off with autofs
Reply
#17
I think I have it now with a variation of the earlier script ie wake up remote server when xbmc is shutdown and in standby.

A proble was that the sleep.d scripts run before the network is backup so I have fudged as below. If both xbmc and server are suspended when xbmc is resumed the server is woken up and after a five second delay xbmc is killed and restarts and re established a connection with the shared mysql library databse OTHER WISE 90% of the time the connection is borked and xbmc crashes. (if there is some other way of doing this without the kill I'd like to know. Suspending xbmc with a -STOP - CONT does not work)
If both are shutdown, xbmc doesnt start until after the network up script has run so the kill just does nothing, 60 seconds pass the server is up then xbmc starts. (I need to fully test from off process but the from resume works great) Also this is on the basis that the server and xbmc will never be of a combination of server shutdown and xbmc suspended.

Thanks for the assistance so far.

/etc/init/net-device-up.conf (I didn't realise this also runs on a resume)

Contents:
Code:
description "Run server wakeup script after network is up"
start on (net-device-up IFACE=wlan0)
script
/path/to/your-script.sh
end script

script:
#!/bin/bash
ping -c 2 192.168.0.2 >/dev/null
if [ $? -eq 1 ] ; then
/usr/bin/wakeonlan 00:1d:92:87:1a:0d
sleep 5
killall -9 xbmc.bin
sleep 60
Reply
#18
I am trying to insert another if so xbmc is only killed if it exists but I am not sure how?

#!/bin/bash
ping -c 2 192.168.0.2 >/dev/null
if [ $? -eq 1 ] ; then
/usr/bin/wakeonlan 00:1d:92:dd:1a:0d
sleep 5
if [ "$(pidof xbmc.bin)" ] ; then
killall -9 xbmc.bin
sleep 60
fi
fi

??
Reply
#19
thats not needed. if it does not exist, killall will do nothing but print an error. The -9 is also not optimal, because there will be no cleanup whatsover. Better use a normal kill to give xbmc a change to finish what it is doing cleanly.

so you might do this instead:
pkill xbmc.bin
Reply
#20
It doesn't seems to restart itself though if I do a pkill.
Reply
#21
a clean restart would be:
service lightdm restart

assuming the script is run as root.
Reply
#22
#!/bin/bash
ping -c 2 192.168.0.2 >/dev/null
if [ $? -eq 1 ] ; then
/usr/bin/wakeonlan 00:1d:92:xx:1a:0d
if pidof xbmc.bin >/dev/null
sleep 2
service lightdm restart
else
sleep 60
fi
fi

This now working as it should, tried the dm restart earlier but it didn't work, works now. I think last time I put it in the sleep.d wakeup script which seems to run before network is up. Anyway, sorted now, power mamangement between both machines working.
Reply

Logout Mark Read Team Forum Stats Members Help
Wakeonlan boot script help0