OpenSprinkler › Forums › Hardware Questions › OpenSprinkler Pi (OSPi) › rc.local woes
- This topic is empty.
-
AuthorPosts
-
May 25, 2013 at 5:59 am #22443
ndboostParticipantso im following the instructions on the interval_program example on github and I cant get the opensprinkler software to fire up on boot..
host=$(hostname -I | sed 's/ *$//g')
port=:80
cd /var/www/opensprinkler/
python ospi.py $host$port
I have set /etc/rc.local to 755, and /var/www/opensprinkler is root:root owned and 777 chmodded. Yet i cant get it to execute the python script on boot
any ideas?
May 26, 2013 at 2:40 pm #23725
pothiboMemberHave you tried to launch the code without rebooting?
I’m a bit rusted with rc.local. Did you try starting it manually and print the error log here?
May 26, 2013 at 3:22 pm #23726
ndboostParticipant@pothibo wrote:
Have you tried to launch the code without rebooting?
I’m a bit rusted with rc.local. Did you try starting it manually and print the error log here?
There Is no error code it starts fine lol
May 26, 2013 at 9:01 pm #23727
ZappParticipantHave you tried it as a one liner in rc.local?
host=$(hostname -I | sed 's/ *$//g');port=:80;cd /var/www/opensprinkler/;python ospi.py $host$port
Also try setting the full path to ‘python’ like ‘/usr/local/bin/python’ <- check that path on your device. I don't have an OSPI!
BTW: Why not skip the ‘cd …’ part and use full paths all the way to minimize any errors?
host=$(hostname -I | sed 's/ *$//g');port=:80;/
/ /python /var/www/opensprinkler/ospi.py $host$port /Jonas…
May 27, 2013 at 12:07 am #23728
RayKeymasterFirst of all, I assume your ospi.py is copied to /var/www/opensprinkler folder, otherwise it obviously won’t find the .py file to run. Second, instead of using the $host and $port variables, I believe you can just do ‘python ospi.py 80’ to start up the program on http port 80. Note that you don’t have to put the files in /var/www/opensprinkler folder — when the python server starts, it will map the http link to whatever folder it’s running the ospi.py program from. For example, you can put it in /home/yourusername/OSPI and run the python program from there.
May 28, 2013 at 1:58 am #23729
ndboostParticipant@ray wrote:
First of all, I assume your ospi.py is copied to /var/www/opensprinkler folder, otherwise it obviously won’t find the .py file to run. Second, instead of using the $host and $port variables, I believe you can just do ‘python ospi.py 80’ to start up the program on http port 80. Note that you don’t have to put the files in /var/www/opensprinkler folder — when the python server starts, it will map the http link to whatever folder it’s running the ospi.py program from. For example, you can put it in /home/yourusername/OSPI and run the python program from there.
I took your advice and changed the rc.local to be like so:
cd /var/www/opensprinkler
/usr/bin/python ospi.py 80
exit 0
i then issued:
sudo reboot
Once the pi rebooted i ran:
ps -ef | grep python
which returned:
pi@opensprinkler ~ $ ps -ef | grep python
root 2130 2128 0 01:56 ? 00:00:00 sudo /usr/bin/python ospi.py 80
root 2131 2130 1 01:56 ? 00:00:01 /usr/bin/python ospi.py 80
pi 2310 2292 0 01:58 pts/0 00:00:00 grep --color=auto pythonseems to be working now. I believe it was the absolute path to python that made it work
I’ll fork the Github repo examples for the interval_program and update it appropriately.
Thanks -
AuthorPosts
- You must be logged in to reply to this topic.
OpenSprinkler › Forums › Hardware Questions › OpenSprinkler Pi (OSPi) › rc.local woes