Personal Weather Station & RaspberryPi – Part 2

||||| 0 Like |||||

When I first installed the Weather Station image to the disk, it worked fine for the intermittent updates (hourly, daily for example). But I wanted to update live statistics to the Weather Underground.

Now, although the script was already there to run, it crashed repeatedly meaning several hours would go by without an update. This was not what I wanted so I searched around and finally came up with the solutions. One was a better script to run the live updates as a “DAEMON” and the other was to put this into “CRON” and run it every minute of every day.

The code to run

This code will check to see if the daemon is running using the PID (Process ID). If it finds that is is running, it simply stops and does nothing else.

However if it does not find the PID it will start up the process again and write out to a log file that it has been restarted.

Cron File

This is the contents of the cron file (Linux Job Schedule) for this script.

@reboot – Tells the Raspberry Pi to run the command when it has finished rebooting

* * * * * – Tells the Raspberry Pi to run the script every minute, of every hour, every day.

Leave a Reply

Your email address will not be published. Required fields are marked *

Advertisment ad adsense adlogger