jeremyRutman
Posts: 4
Joined: Mon Jan 04, 2016 5:30 am

raspi startup

Fri Jan 08, 2016 9:24 pm

I have a raspi that I want to have run a python script on boot .
I did this after boot to gui using a line in /etc/xdg/lxsession/LXDE-pi/autostart
and I see the script is running with ps but 'headless' - the tty is ? and I don't see any output at all - and it doesn't write to its logfile (which it does if i start by hand)

If I boot to cli and run my script from rc.local then at least I see its output .
However now it doesn't seem able to run the movie (using omxplayer) that I need to run on boot,
and furthermore this method is 'unstoppable' - ctrl-C doesn't stop the script so I have
to kill remotely by ssh.

There is a 'pipresents' package that museaums use for this kind of thing - so I know its possible.
Anyone have some avenues to check?

elatllat
Posts: 1337
Joined: Sat Dec 17, 2011 5:05 pm

Re: raspi startup

Sat Jan 09, 2016 6:51 am

use a service.
check printenv.
SBC with 32GB RAM: https://hardkernel.com

FAQ : https://raspberrypi.stackexchange.com

Unanswered: https://www.raspberrypi.org/forums/search.php?search_id=unanswered

jeremyRutman
Posts: 4
Joined: Mon Jan 04, 2016 5:30 am

Re: raspi startup

Sat Jan 09, 2016 9:25 pm

problem solved - a conflation of three gotchas
1. fully qualified paths needed in rc.local
2. background anything you do in rc.local if its a continuous (non-ending) process - startup doesnt end with rc.local .
Maybe its ok actually, I don't know, but boot won't finish if you don't bg and the process doesnt stop, which prob. isn't good.
3. fully qualified paths within python script

so, in /etc/rc.local:
sudo python /home/pi/jr/mypy.py &

happily runs movies from mypy.py, which has lines:

import pexpect
a = pexpect.spawn("usr/bin/omxplayer -o hdmi /home/pi/jr/mov1.mp4")

:ugeek: feeling like an ubergeek

Return to “Troubleshooting”