OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) can’t autostart…rc.local or init.d

  • This topic is empty.
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
  • #22620


    I’ve tried everything to get to start automatically. I’m using wheezy on a rev 2 raspberry pi. It loads up to the gui and that’s about it.I can manually start it without a problem but using the autostart method in rc.local didn’t work or the init.d method either. Autostart is a necessity since I have a greenhouse with drippers relying on my sprinkler pi to stay alive.I am a linux noob but in no way a computer noob. Am I missing a simpke setting or something? I installed rszimm’ s sprinklers-pi profram and it worked, even autostarted but I can’t seem for the life of me to get this goinf. Can someone plz help me out? Please let me know what info you need to help me get this going. Thank u in advance!!!


    Dan in CA


    When you say it loads up to the GUI, do you mean you can log into the web interface over the network?

    Are you using Samer’s mobile web app with the program?

    You might check this post if you haven’t seen it.

    If you have both the rc.local script and the init.d scripts installed, you should comment out the rc.local script.
    If you are using the rc.local script, you can test if the program is running by issuing the command:
    /etc/init.d/ospi status
    EDIT: That should be if you are using the init.d script, you can use the status command.

    Are you using port :8080 in the start up script? and adding the port to the URL when you try to access the program from the network?

    Also, is your OSPi directory located as a sub directory of the Pi home directory? If it is located somewhere else you would need to modify the start up script to point to that path.




    OK I got so frustrated last night I deleted my sdcard and reinstalle noobs on it.try it from the beginning. When i said GUI I meant xserver. My lxde desktop. ill post back when Im done
    thank you


    Member loads the lxde wifi is connected but sprinkler program doesn’t autostart. I used the autostart method in the readme.txt file. What’s my next step. Thank you in advance



    Oh, btw I’m not using the web mobile app.atleast not yet.
    I’m using port 8080 in startup script but tried both 8080 and 80
    I also triple checked my directory

    When you are talking about rc.local or init.d does it make a diffetence if I’m using a desktop gui like lxde or is it specificaly for command prompt start ups?



    I’ve mentioned this before but deleted it because it threw a wrench into things. However, I found a well written how-to for crontab and therefore bringing it up again.

    First off the guide is available here:

    Second, this method is dead simple once you know how crontab works, I believe crontab is installed by default, sciprts are run late enough in the boot sequence to execute without conflict, etc. To recap the link all you do is:

    sudo crontab -e

    Add the following line:

    @reboot python /home/pi/OSPi/ &

    Dan in CA

    Also, since you are using wifi, you might try adding a delay to the rc.local script as described in this post:



    I am struggling with this as well. Got the init.d script created and chmod to executable. This is the response I get when I attempt to get status:

    pi@jlm-rpi ~ $ /etc/init.d/ospi status
    -bash: /etc/init.d/ospi: /bin/sh^M: bad interpreter: No such file or directory

    There is a file /bin/sh but it is not text, cannot tell what it is. Any advice from the Linux gurus?



    The ^M in your error makes me wonder if you somehow added DOS type line endings () to the /etc/init.d/ospy script when you created it. The script needs to have only Linux/Unix type line endings ().

    There is a utility that will convert the line endings for you that is not installed in Raspbian by default. You can install it like this:

    sudo aptitude update
    sudo aptitude install dos2unix

    You may notice there are other updates offered. If you want to keep your whole system up to date do

    sudo aptitude safe-upgrade

    To change the DOS line endings to linux line endings:

    sudo su - root
    cd /etc/init.d
    mv ospi ospi.dos
    dos2unix < ospi.dos > ospi

    Make the script executable

    chmod +x ospi

    Try it

    ./ospy start

    Hope this helps…


    Dan in CA

    If you are working from a windows system you should take a look at winSCP:

    I use it to transfer files between my windows system and the Pi. It handles line ending conversion automatically. You can also brows the files on the Pi just like using windows explorer and Open and edit files on the Pi from your windows system.

    It is an indispensable tool for me.




    got mine working!!!!! im so happy. i changed my raspi-config so that it doesn’t boot up into the desktop graphical interface and the problem was solved. damn. i knew it must of been a silly setting or something i was missing. i rebooted it like a million times just to make sure that it works and i set up my portforwarding so that i can access my opensprinkler from my cell phone from anywhere any time. I love it!!!!
    thank you so much for all the help



    got mine working as well! Seems it was the DOS cr/lf causing the problems. I used the suggested utilities to clean it up, now the init.d script works as advertised.

    Many thanks to Denny and Dan for your assistance! My yard and my wife will be happy now that I can step away from this project for a while. 😀




    Congrats on getting it running!

    I know that frustration of not having it work right and then the coolness of figuring out the problem and finally getting it all up and running.

    Just fixed the time setting on mine that was kicking my butt for a coupe of weeks. Everything works as advertised now. Sweet!


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

OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) can’t autostart…rc.local or init.d