• How to run terminal command lines on startup?
    6 replies, posted
Hello, I have a question. How do I run these commands on startup? For some reason I just can't make them run automatically... I usually run them using the command line terminal. They are for object detection using openCV, ran on Raspberry Pi 3B on Raspbian Stretch. The commands starts a virtual environment (cv), bring us to my desktop directory, then run the Python 3 scripts. source ~/.profile workon cv cd /home/pi/Desktop/pi-object-detection python pi_object_detection.py \ --prototxt MobileNetSSD_deploy.prototxt.txt \ --model MobileNetSSD_deploy.caffemodel Any help is appreciated. Thanks in advance
Shell Script? raspbian
Will I need to change those codes to use in startup Shell Script? For some reason it just won't execute. Does it have something to do with the fact that my openCV script need to run in the virtual environmen (cv)? Would those commands (source, workon, cd) even acceptable for use in Shell Script?
Figured out some things The script works when started manually as executable, but fail to run without warning on startup. This might be because it need desktop/windows to start first. It cant boot to CLI. So I just need it to run automatically, AFTER the Raspbian desktop has been booted. But how? Anybody can point me in a right direction? Thanks
Finally it works. The gist of it. I had to make a launcher script: source ~/.profile workon cv cd /home/pi/Desktop/pi-object-detection python pi_object_detection.py \ --prototxt MobileNetSSD_deploy.prototxt.txt \ --model MobileNetSSD_deploy.caffemodel And then chmod it to turn it into an executable, along with is .py files And then add that launcher in the config file /.config/lxsession/LXDE/autostart I was confused because there was several version of LXDE config files, and only that directory actually do anything, also they are all different for different raspbian. Also I cant start the program at startup, because the script depends on desktop/windows. So I need to start it AFTER the desktop is booted. Welp, a job I thought would take 5 minutes turn into half a day. We live and learn I guess
Maybe there is a startup file for the window manager? Might be worth checking
https://wiki.lxde.org/en/LXSession#Autostarted_applications_using_lxsession
Sorry, you need to Log In to post a reply to this thread.