Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
323 views
in Technique[技术] by (71.8m points)

How to run Python script from startup in Raspberry pi

I have tried doing in rc.local , bashrc file but rc.local not showing any log or not clear if it is running. bashrc is making the script run only when i open the terminal. I need to run without user intervention and my script involves network connection and websocket communication. So running in startup will ensure i get network? Thank you in advance.

question from:https://stackoverflow.com/questions/65950594/how-to-run-python-script-from-startup-in-raspberry-pi

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

you can connect a LED to your raspberry pi to check weather your code is running or not

/home/pi/bashrc.
sudo python3 #LED file 
sudo python3 #your file name

this should make your code run every time the power is on its not depend that you open the terminal or not


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...