• This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #22443

    ndboost
    Participant

    so 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?

    #23725

    pothibo
    Member

    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?

    #23726

    ndboost
    Participant

    @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

    #23727

    Zapp
    Participant

    Have 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…

    #23728

    Ray
    Keymaster

    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.

    #23729

    ndboost
    Participant

    @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:

    [email protected] ~ $ 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 python

    seems 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

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.