Sending data to COSM program stopping

Moderators: adafruit_support_bill, adafruit

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/
Locked
User avatar
egutting
 
Posts: 297
Joined: Wed Nov 14, 2012 12:57 am

Sending data to COSM program stopping

Post by egutting »

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!

User avatar
svinzant
 
Posts: 19
Joined: Mon May 16, 2011 2:30 pm

Re: Sending data to COSM program stopping

Post by svinzant »

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

User avatar
egutting
 
Posts: 297
Joined: Wed Nov 14, 2012 12:57 am

Re: Sending data to COSM program stopping

Post by egutting »

That worked great! Thanks!

User avatar
e024576
 
Posts: 46
Joined: Thu Jan 05, 2012 5:04 pm

Re: Sending data to COSM program stopping

Post by e024576 »

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

User avatar
svinzant
 
Posts: 19
Joined: Mon May 16, 2011 2:30 pm

Re: Sending data to COSM program stopping

Post by svinzant »

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

User avatar
svinzant
 
Posts: 19
Joined: Mon May 16, 2011 2:30 pm

Re: Sending data to COSM program stopping

Post by svinzant »

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

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

* * * * * 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

Locked
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/

Return to “Adafruit Raspberry Pi® accessories”