Forum

Full Version: Best way to run python script with Xbian?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
HI,

Probably a bit noobish, but what's the best/preferred way to run a python script at start up to run alongside xbian without prbolems?

I want to start looking into some hardware/automation stuff soon.

Skywatch.
You could use "nano /etc/rc.local" to execute commands at startup of your Rpi for example.
I'm a noob....I used the upstart.conf route, /etc/init/ , it works for me for grabbing an event before xbmc does at start-up and can also respwan if necessary. Here is the one i wrote... uimapper.conf to exec the python code

http://markamc.cybaman.net/?p=50

hope it helps

mark
Yes, the best way would be to write upstart script /etc/init/my_python_script.conf

Code:
#!upstart

start on startup
stop on runlevel [06]

respawn

exec python /path/to/my/python/script.py

If it should run constantly, respawn will re-start the script if crashed (exited with return code different than 0).

If it is just task-like script (should be started - do something - and exit), remove "respawn" a put "task" instead.

It will be started with startup of XBian and depending whether it's "task" or not, it will remain running (check with "status my_python_script") or will just start, do the job and stop.

If the script is providing some output text, it can be found at /var/log/upstart/my_python_script.log .
Thanks for that - It will need to run constantly as it will be controlling the power to the amp and probably some lighting as well.

Does anyone know if it is possible to run WebIOPI alongside xbian? This will be crucial to the plan. Can I use startup to get this going too?

Cheers!

Skywatch
if it runs on Debian, there is 99% probability that it will run on XBian as well.
Reference URL's