Kodi Community Forum
[LIVE] Run script from remote.xml, stop XBMC but keep script running - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: OS independent / Other (https://forum.kodi.tv/forumdisplay.php?fid=228)
+---- Thread: [LIVE] Run script from remote.xml, stop XBMC but keep script running (/showthread.php?tid=75582)



[LIVE] Run script from remote.xml, stop XBMC but keep script running - wronex - 2010-06-13

I have configured my remote.xml to run a bash script when I press the "Clear" button on my MCE remote control.

The bash script was intended to do the following:
  1. Stop XBMC
  2. Perform some tasks
  3. Start XBMC

But when the script stops XBMC it also kills itself, leaving me with a black screen. Sad The script needs to keep running to perform the tasks and then start XBMC again. How can I achieve this?

If I remember correctly the entry in the remote.xml looks like this:

Code:
<clear>System.Exec("sudo sh /etc/X11/toggle.sh &")</clear>

I have used the following commands to stop and start XBMC (is there a better way?):

Code:
sudo /etc/init.d/xbmc-live stop
sudo /etc/init.d/xbmc-live start

I have disabled the sudo password.


- jhsrennie - 2010-06-14

Presumably the stop command is killing child processes as well, so you need a way to kill a process without killing it's children.

JR


- wronex - 2010-06-21

jhsrennie Wrote:Presumably the stop command is killing child processes as well, so you need a way to kill a process without killing it's children.

Sound correct. Anyone knows how to do that?

Or maybe I can perform the tasks while XBMC is running and then restart it with a single command, thus not getting into the child process problem?

I am trying to change my xorg.conf at run time and without restarting the computer.

Is there a single line command that can be run from bash to restart only the xbmc app.


- wronex - 2010-06-21

I have tried "sudo /etc/init.d/xbmc-live restart" without luck...


- jhsrennie - 2010-06-21

I think Python can create detached processes. You could use a Python script to create a detached process that does whatever you want then restarts XBMC.

JR


- wronex - 2010-06-22

Can't say I'm any good at Python. But I will give it a try!

Thanks for the help jhsrennie!