In looking for a backup solution for the weewx sqlite databases,  I found 
one in the most unlikely of places - weewx. :-)

Because the read only pi 
<https://github.com/glennmckechnie/rorpi-raspberrypi/wiki/Rorpi-Home> I 
bang on about can (optionally) keep the database in its own ramfs, there 
was a need to preserve that in case of failure.
That aside, having a backup of the database is an essential anyway.

As I understand it, the report cycle in weewx only starts once all writes 
to the database have finished, this provides some assurance that any copy 
of the database taken at that time will be a good one.

How to do it...
It relies on the ability to use multiple instances of a skin by simply 
giving them their own skin [[section]] name in the weewx.conf file, or 
skin.conf file

[[RSYNCSQL]]
  skin = Rsync

Redefining HTML_ROOT (only within the skin itself) to point to the local 
database

[[RSYNCSQL]]
        skin = Rsync
        HTML_ROOT = /var/lib/weewx

Add the rest to get it to start

[[RSYNCSQL]]
        skin = Rsync
        HTML_ROOT = /var/lib/weewx
        server = 192.168.0.100
        user = graybeard
        path = /home/graybeard/rsynsql-weewx1

Finally, add a report_time stanza of your choosing (or not if you want a 
rolling copy)
It would pay to check your archive_interval in weewx.conf, and make this 
longer than that.

To me, besides catching the database between archive intervals, this the 
real sweetener.

[[RSYNCSQL]]
        skin = Rsync
        HTML_ROOT = /var/lib/weewx
        # If it's local, an ip address is fine for the server
        server = 192.168.0.100
        # account that has password less access to the server
        user = graybeard
        # where to put it all, don't nest too deeply unless you create the 
tree first
        path = /home/graybeard/rsynsql-weewx
        # every 20 minutes, run this report
        report_timing = '*/20 * * * *'
        # add the default
        delete = 0

Alternatively, transfer it all to a skin.conf file and that way you can 
make changes
to your setup while weewx is running.


In weewx.conf
[[RSYNCSQL]]
        skin = Rsyncsql
        #HTML_ROOT = /var/lib/weewx
        # If it's local, an ip address is fine for the server
        #server = 192.168.0.100
        # account that has password less access to the server
        #user = graybeard
        # where to put it all, don't nest too deeply unless you create the 
tree first
        #path = /home/graybeard/rsynsql-weewx1
        # every 20 minutes, run this report
        # report_timing = '*/20 * * * *'
        # add the default
        delete = 0


cd skins
cp -r Rsync Rsyncsql/
edit skins/Rsyncsql/skin.conf and add the following after the comments at 
the top...

        HTML_ROOT = /var/lib/weewx
        # If it's local, an ip address is fine for the server
        server = 192.168.0.100
        # account that has password less access to the server
        user = graybeard
        # where to put it all, don't nest too deeply unless you create the 
tree first
        path = /home/graybeard/rsynsql-weewx-skin
        # every 20 minutes, run this report
        report_timing = '*/20 * * * *'
        # add the default
        delete = 0

Finally, create the passwordless access for the remote user, from the local 
root (the account weewx is running as)

I'll add the above, and expand on it, to the weewx wiki

https://github.com/weewx/weewx/wiki/Using-the-RSYNC-skin-as-a-backup-solution

Lastly - 

The above works well, but the copy is continuosly updated. I've tweaked 
rsyncupload to add a dated directory structure and that appers to be 
working well although it brings its own problems. I'll post about that 
seperately, on the dev list.









-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to