mcdrichj427
Posts: 2
Joined: Sun Nov 05, 2017 7:42 pm

Raspbian Autostart

Sat Oct 13, 2018 7:49 pm

Im trying to use /home/pi/.config/lxsessions/LXDE-pi/autostart to run a python program in a terminal window. The trouble I am having is that the terminal window pops up and closes even though the program should run indefinitely. I have used the code on another pi with no issue but I for the life of me cant get the program to start after Raspbian loads. The autostart file looks like this...

Code: Select all

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@point-rpi
@lxterminal --command sudo python /home/pi/Desktop/GrowHub/System/GrowHub.py
What am I missing can someone please help me?

DirkS
Posts: 9047
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Raspbian Autostart

Sat Oct 13, 2018 8:33 pm

For testing: open a terminal window and run the command manually.
Does it start / run as expected?

klricks
Posts: 5835
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Raspbian Autostart

Sat Oct 13, 2018 9:54 pm

mcdrichj427 wrote:
Sat Oct 13, 2018 7:49 pm

Code: Select all

@lxterminal --command sudo python /home/pi/Desktop/GrowHub/System/GrowHub.py
What am I missing can someone please help me?
You can use -e instead of --command.
Normally you should not use sudo for anything in the users home directory.
Make sure any calls embedded in your script have the complete path included. If not full path then it may work from command line but it won't work from a call to lxterminal.

Code: Select all

@lxterminal -e python /home/pi/Desktop/GrowHub/System/GrowHub.py
If the file has the proper 'shebang' as first line #!/usr/bin/python and the file is made executable then start the program like this:

Code: Select all

@lxterminal -e /home/pi/Desktop/GrowHub/System/GrowHub.py
Unless specified otherwise my response is based on the latest and fully updated Raspbian Stretch w/ Desktop OS.

Return to “Troubleshooting”

Who is online

Users browsing this forum: Baidu [Spider], jshannon, mfa298 and 34 guests