Page 1 of 1

Raspbian Autostart

Posted: Sat Oct 13, 2018 7:49 pm
by mcdrichj427
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?

Re: Raspbian Autostart

Posted: Sat Oct 13, 2018 8:33 pm
by DirkS
For testing: open a terminal window and run the command manually.
Does it start / run as expected?

Re: Raspbian Autostart

Posted: Sat Oct 13, 2018 9:54 pm
by klricks
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