Forum
  • Search
  • Member List
  • Calendar
Hello There, Guest! Login Register — Login with Facebook

Best way to run python script with Xbian?
Thank you for your donation

Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threaded Mode | Linear Mode
Best way to run python script with Xbian?
7th Sep, 2013, 07:22 PM
Post: #1
Skywatch Offline
Registered
Posts: 1,018
Joined: Mar 2013
Reputation: 28
Best way to run python script with Xbian?
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.
Find all posts by this user
Quote this message in a reply
7th Sep, 2013, 07:59 PM
Post: #2
namtih Offline
Tester
Posts: 269
Joined: Dec 2012
Reputation: 28
RE: Best way to run python script with Xbian?
You could use "nano /etc/rc.local" to execute commands at startup of your Rpi for example.
Find all posts by this user
Quote this message in a reply
8th Sep, 2013, 05:29 AM
Post: #3
Markamc Offline
Registered
Posts: 94
Joined: Apr 2013
Reputation: 4
RE: Best way to run python script with Xbian?
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
Find all posts by this user
Quote this message in a reply
8th Sep, 2013, 06:46 AM
Post: #4
mk01 Offline
Registered
Posts: 2,485
Joined: Mar 2013
Reputation: 209
RE: Best way to run python script with Xbian?
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 .

Please read rules and do a search before you post! . FAQs . How to post log file? . Looking for answers? Please start here
Find all posts by this user
Quote this message in a reply
13th Sep, 2013, 07:37 PM
Post: #5
Skywatch Offline
Registered
Posts: 1,018
Joined: Mar 2013
Reputation: 28
RE: Best way to run python script with Xbian?
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
Find all posts by this user
Quote this message in a reply
15th Sep, 2013, 09:37 AM
Post: #6
mk01 Offline
Registered
Posts: 2,485
Joined: Mar 2013
Reputation: 209
RE: Best way to run python script with Xbian?
if it runs on Debian, there is 99% probability that it will run on XBian as well.

Please read rules and do a search before you post! . FAQs . How to post log file? . Looking for answers? Please start here
Find all posts by this user
Quote this message in a reply
« Next Oldest | Next Newest »
Post Reply 


  • View a Printable Version
  • Send this Thread to a Friend
  • Subscribe to this thread
Forum Jump:

Current time: 29th Mar, 2023, 05:37 PM Powered By MyBB, © 2002-2023 MyBB Group.