Run Terminal Commands On Raspberry Startup
I am working on a project in which I am using curses and pygame librarie, my python program/script can only be run through using terminal otherwise this error occurs fd=_sys.__stdo
Solution 1:
Running on startup, e.g., using rc.local
, there's at least two problems:
- the
TERM
environment variable is not set (giving thesetupterm: could not find terminal
message) - you won't be able to handle input, only output...
Solution 2:
I spent around 1 day and test 4 solutions for Linux/raspberry startup run script issues. Then here is the solution (I choose crontab)
- open crontab (use linux@crontab -e -> not use sudo crontab -e ... thats could be error in future some access for script etc.)
pi@ crontab -e
Then choose nano and edit like this... It is tricky, ı found after test may be more than 10x times:
@reboot cd /home/pi/beetool && /usr/bin/python3 run.py &
My code is waiting for me under /home/pi/beetool. If you don't change the directory that occurs error.
And my code uses infinite loop so I have to finish with "&" as you see above.
So I hope that helps someone, too ...
Post a Comment for "Run Terminal Commands On Raspberry Startup"