Need to keep a script I called from an add-on running after I kill Kodi, is it possible?

  • I made a small add-on that works as a launcher. basically is just this

    Code
    xbmc.executebuiltin('System.Exec("/usr/bin/pegasus-fe.sh")')
    xbmc.executebuiltin('Quit')

    Script runs fine, but it gets killed as soon as Kodi quits, I understand why it does it, but it's there a way to run a script and keep it running after Kodi quits?

  • nohup doesn't work.

    I think only systemd-run will work. Check why your script doesn't like it.

    yeah, nothing seems to work, except systemd (I have tried it with another program and it works)

    Try to add & after the command: os.system("command &")

    Try "nohup /usr/bin/pegasus-fe.sh"

    nohup does not work, adding a & at the end doesn't either :( guess I will have to tackle this from another perspective.

    Thanks for the help!

  • Maybe try the combination of nohup and the ampersand: "nohup command &".

    If I issue this command from a shell, log out from the kodi box and re-login again I can see the command still running. Which does not mean it will work for you as well, but you might give it a try.

  • Maybe try the combination of nohup and the ampersand: "nohup command &".

    If I issue this command from a shell, log out from the kodi box and re-login again I can see the command still running. Which does not mean it will work for you as well, but you might give it a try.

    Tried that as well.

    not sure what you mean by running it from the shell, that will of course work since you are running it on a separate process. The problem comes when you call it from within Kodi (since it creates a child process) so when you quit it will also take all of the child processes. Unless I am very confused on how this works.

  • If you really can't use systemd-run then use little more hackish approach.

    Make one helper script which runs before kodi (run it from autostart). In this script make a loop and inside loop start your pegasus-fe.sh script. And to know when to start it and when to stop use one temporary file which is created from kodi or some signal.

  • If you really can't use systemd-run then use little more hackish approach.

    Make one helper script which runs before kodi (run it from autostart). In this script make a loop and inside loop start your pegasus-fe.sh script. And to know when to start it and when to stop use one temporary file which is created from kodi or some signal.

    That is actually a good idea! I will try that, thanks!