- This topic is empty.
August 28, 2013 at 7:02 pm #22620
I’ve tried everything to get ospi.py 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!!!August 28, 2013 at 9:56 pm #25461
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:
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.
DanAugust 29, 2013 at 5:18 pm #25462
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 youAugust 29, 2013 at 7:26 pm #25463
Nothing.it loads the lxde desktop.my 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 advanceAugust 29, 2013 at 7:31 pm #25464
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?August 29, 2013 at 11:18 pm #25465
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: http://www.raspberrypi-spy.co.uk/2013/07/running-a-python-script-at-boot-using-cron/
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/ospi.py &August 29, 2013 at 11:44 pm #25466
Also, since you are using wifi, you might try adding a delay to the rc.local script as described in this post:
viewtopic.php?f=28&t=207#p1294August 30, 2013 at 3:31 am #25467
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:
[email protected] ~ $ /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?August 30, 2013 at 2:44 pm #25468
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
mv ospi ospi.dos
dos2unix < ospi.dos > ospi
Make the script executable
chmod +x ospi
Hope this helps…August 30, 2013 at 3:53 pm #25469
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.
DanAugust 30, 2013 at 10:23 pm #25470
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
TommyAugust 31, 2013 at 12:14 am #25471
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. 😀August 31, 2013 at 12:18 am #25472
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!
- You must be logged in to reply to this topic.