Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/

Sending data to COSM program stopping

by egutting on Fri Nov 16, 2012 8:27 am

Hello, I was able get the RPi to read the temp and send it in, but after about 2 hours the python program seems to stop. Is this normal?
Thanks!
egutting
 
Posts: 180
Joined: Tue Nov 13, 2012 11:57 pm

Re: Sending data to COSM program stopping

by svinzant on Fri Nov 16, 2012 12:59 pm

I was doing something similar with this tutorial and having a similar problem. I was able to keep the script running for 24 to 30 hours before I needed to restart it.
I eventually took the "While (True)" part of the loop out of the code and set up a cron job to run every minute and execute the code. Check out this feed. Or my dashboard.
Scott
svinzant
 
Posts: 17
Joined: Mon May 16, 2011 1:30 pm

Re: Sending data to COSM program stopping

by egutting on Fri Nov 16, 2012 11:21 pm

That worked great! Thanks!
egutting
 
Posts: 180
Joined: Tue Nov 13, 2012 11:57 pm

Re: Sending data to COSM program stopping

by e024576 on Mon Dec 17, 2012 9:43 pm

Regarding "I eventually took the "While (True)" part of the loop out of the code and set up a cron job to run every minute and execute the code." Can you say a little more about setting up a cron job. Here's the command that I enter from the command line which does work: "sudo /home/pi/python/oneshot-cosm-temp.py" To define the cron job I entered "crontab -e" and then put in a single line

* * * * * root home/pi/python/oneshot-cosm-temp.py

The result is - no error messages, but nothing is written to my screen nor sent to cosm. So as far as I can tell, my cron job does nothing

Any ideas?

thanks
e024576
 
Posts: 19
Joined: Thu Jan 05, 2012 4:04 pm

Re: Sending data to COSM program stopping

by svinzant on Wed Dec 19, 2012 3:32 pm

e024576,
I am at work right now.
Once I get home, I will look over my notes and see if I can shed some light on your question.
Scott
svinzant
 
Posts: 17
Joined: Mon May 16, 2011 1:30 pm

Re: Sending data to COSM program stopping

by svinzant on Wed Dec 19, 2012 11:16 pm

e024576,
Sorry I didn't get back to you sooner. I got busy with a few things, then forgot all about replying...
So, here is what I can tell you:
I created a small script called Get_Temp.sh that looks like this:
Code: Select all | TOGGLE FULL SIZE
cd Adafruit-Raspberry-Pi-Python-Code/Adafruit_DHT_Driver
sudo ./DHT_Temp.py

DHT_Temp.py is my hacked up Python program that I discussed up above.

For my crontab setup, it looks like this:
Code: Select all | TOGGLE FULL SIZE
* * * * * sudo ./Get_Temp.sh


I am no Linux expert, I'm sure I have not done things they way the Linux "purists" would like to see them done.
But, I do know it works!
I hope this helps... If not, ask more questions!
Scott
svinzant
 
Posts: 17
Joined: Mon May 16, 2011 1:30 pm