G+_Tom Dempsey Posted March 7, 2017 Share Posted March 7, 2017 So I built this solar powered weather station. Using the Raspberry Pi and Grove connectors. It all works great. Now I'm trying to configure Linux to automatically run the Python script that controls the station when it boots up. Link to comment Share on other sites More sharing options...
G+_Russ DiBennetto Posted March 7, 2017 Share Posted March 7, 2017 There are two ways you can do that. The best way is to edit (if exists) or create an /etc/rc.local file and put the python command line in that file. There is a lot of information on-line about /etc/rc.local file configuration. The other way is to create a bash script to test to see if the weather station program is running like run a command "ps -ae | grep python" and if the python process is not running start it up. This command would going into your crontab. You can edit your crontab by executing crontab -e and set a schedule for the bash script to run. I do these command via the command line interface. I hope this helps. Link to comment Share on other sites More sharing options...
G+_Tom Dempsey Posted March 8, 2017 Author Share Posted March 8, 2017 Thanks Russ. I've been trying the RC.local way all day. I just installed Cron, and I'll try it that way. Thanks again. Link to comment Share on other sites More sharing options...
G+_Russ DiBennetto Posted March 8, 2017 Share Posted March 8, 2017 Hope your able to get it running. One point I forgot to mention. If you execute a bash script in cron, make sure that you use the chmod command to change privileges so your bash script has at least execute privilege or it won't run. Being my Raspberry Pi runs on a closed internal network, I usually just set my privileges so everyone has read, write, execute privileges "chmod 777 {your script name}. Let me know how you make out and good luck. Link to comment Share on other sites More sharing options...
G+_Tom Dempsey Posted March 8, 2017 Author Share Posted March 8, 2017 I was able to get the script to run. But it stops with a ImportError No module named SDL_Pi_INA3321. But the whole thing works if I run it manually. Thanks for the help. I'll figure out this module error. Link to comment Share on other sites More sharing options...
Recommended Posts