#!/bin/bash
tar cvzf /media/weather_backup/weather_$(date +%d:%m:%y_%H:%M).tar.gz /etc/weewx /etc/nginx /var/lib/weewx /var/www/weewx/
find /media/weather_backup -mtime +7 -name "weather*.tar.gz" -exec rm -f {} \;
Thank you for the script, however I am curious about one thing, your script does a sqlite database file copy, what if during file copying the file is actually written by weewx and the copy is not consistent? There's a very little chance about that but not a zero? I am not an expert but sqlite itself has some means for database backup. Another solution is to shut down weewx, do a file copy and then run weewx once again.
--
You received this message because you are subscribed to the Google Groups "Weewx user's group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Weewx user's group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/ha-mbc6zkpY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Weewx user's group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
weewx@fhpwx ~/test15 $ sqlite3 weewx.sdb.bad
SQLite version 3.7.13 2012-06-11 02:05:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> pragma integrity_check;
*** in database main ***
On tree page 1239 cell 2: Rowid 1399562700 out of order (previous was 1936433312)
Corruption detected in cell 0 on page 1239
Corruption detected in cell 1 on page 1239
Corruption detected in cell 2 on page 1239
Fragmentation of 573 bytes reported as 0 on page 1239
Page 1436: btreeInitPage() returns error code 11
On tree page 1385 cell 80: Child page depth differs
On tree page 2 cell 15: Child page depth differs
On tree page 2 cell 16: Child page depth differs
rowid 1936433312 missing from index sqlite_autoindex_archive_1
Error: database disk image is malformed
sqlite>
I've used the dump command to recover from a damaged database file, but I'm not sure why you would use that instead of backup to create a backup copy, since the dump output is significantly larger.
In either case if weewx tries to do an update while the dump (or backup) command is running, weewx will report a "database locked" error and stop. Might as well just stop it and then just copy the files.
I've used a backup copy but, true, I have not run an integrity check. When I get home I'll give it a try. Maybe I have a 5 year store of nothing but bad sqlite databases. :-)
Good data!
It does not surprise me that the gzipped dump file is smaller --- it does not contain as much information. It's missing the indexes.
-tk
Fat-fingered from my Android
Seeing this post it got me wondering, yet again, about hpw often the detailed archive data is used outside of say a two year window (current year and previous year). It seems to me to be logical that at the end of the year weewx should create a dump file of the archive data from (year end - 2) and retain year. The daily summary data can be retained ad infinitum. This then opens up the possibility to be a little bit like mesowx and have three levels of record in the database:
I am surprised if it takes you more than 2 years to find and correct archive errors!! Under my suggestion regeneration of summaries etc would involve deletion and rebuilding for the time period covered by the current archive (eg 2 yrs).
Old data is still available (always) from the summary tables - how often do you really need to query the detailed archive instead of the daily summaries when dealing with data more than 2 yrs old??
weewx does not save Loop data - but mesowx does - and I merely suggest including mesowx approach to loop data as part of having an archive hierarchy instead of the current flat 'retain everything regardless' archive database.
--
You received this message because you are subscribed to the Google Groups "weewx-user" group.