2011-05-15, 10:03
lightshow12 Wrote:In your script, you perhaps do a ps -aef | grep emulatorprocess and when there is not a process running you can have it launch xbmc.
Or add a new cronjob with crontab -e
and tell it to run this script every 5 sec
#!/bin/bash
#variables
# wc -l will give you a result in numbers; normally when you grep a process you get one result for your actual search process pid and then another one for the process running
xbmcrunning=`ps -aef | grep xbmc | wc -l`
emulatorxrunning=`ps -aef | grep xbmc | wc -l`
#psuedo code
# xbmc is runing and emulator is running
if xbmcrunning = 2 and emulatorxrunning = 2
kill xbmc or minimize or something
# emualtor is not running and xbmc is not running -> case when you exit emulator
if xbmcrunning = 1 and emulatorxrunning = 1
start xbmc
Of course, you'd add better syntax, but this is just an idea of one way you can do it.
Thanks mate, understand that. It appears however that sudo /etc/init.d/xbmclive stop doesnt close X and xbmc when run through a bash script. I cant just kill xbmc.bin as it automatically reloads as its classed as the x windows manager in xbmclive. Im seriously thinking that the best way is re-install using ubuntu desktop and remove xbmclive. This will allow me to kill xbmc.bin, run the emu then reload xbmc using malte's script.