> I don't know how I can make sure the database is not in the middle of a transaction when I'm attempting the copy.
Do a sha1sum of the database: sha1sum /home/weewx/archive/weewx.sdb Make the copy. Do another sha1sum of the database: sha1sum /home/weewx/archive/weewx.sdb
If the sha1 hasn’t changed, you have a good copy. If it has changed, sleep and try again.
Cron job and copy of the copy sounds like a good plan. Thanks!
- Jeff
On Friday, June 21, 2024 at 2:00:18 PM UTC-7 p q wrote:
I run a cron job at 2am that shuts down Weewx, copies the database and restarts it. I used to then copy the backup copy to google drive, but google made the authentication impossible, so I stopped doing that part. I just manually copy it from time to time - perhaps I should do what you're doing with pscp too. Anyway, copying the copy would protect you from a conflict.
Hello,
Just recently installed weewx and I'm looking for the best way to make regular backups. My plan is to create a Windows batch file that uses pscp to copy all the relevant files to a folder on my Windows system and schedule that to run daily. Pretty straightforward, but I'm concerned about getting a valid copy of the sqlite database file. The docs make this warning:
For a SQLite configuration, do not make the copy of the database file while in the middle of a transaction! Schedule the backup for immediately after an archive record is written, and then make sure the backup completes before the next archive record arrives.
I don't know how I can make sure the database is not in the middle of a transaction when I'm attempting the copy. Shutting down and restarting weewx I guess is possible using ssh commands in the batch file, but that's getting more complicated. How worried do I need to be about getting a bad backup file if I just copy the file over?
Thanks!
--
--
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].
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/f0f5983d-f11f-471e-9f46-bce458053fa2n%40googlegroups.com.
--
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].
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/E57C07F5-591C-423D-B863-96872D35FC31%40johnkline.com.
|