This has been asked and answered literally dozens of times here over the 
years. Please do a little searching of the old posts for so many threads 
and methods that it's impossible to reiterate here.  There are also long 
discussions of how to validate your backup is good for using to restore 
your system in the future.

Short answer is 'copy' to a temporary file.  Compress the temporary file. 
 No need to stop/restart weewx if you use sqlite3 typically.
 
On Sunday, October 29, 2023 at 12:59:16 PM UTC-7 Lorin Tremblay wrote:

> Hi!
>
> Was wondering If this bash script is an acceptable method to back up the 
> weewx database on the daily..
>
> Here is my bash script to do so and I have a cron job that triggers It at 
> 00:01 everyday...
>
> # Stop weewx
>
> sudo systemctl stop weewx
>
>
> # Define the date format for backup filename
>
> DATE=$(date +*"%Y%m%d_%H%M%S"*)
>
>
> # Backup database (assuming the database is at /var/lib/weewx/weewx.sdb; 
> adjust if different)
>
> sudo zip* -r* *"/var/lib/weewx/weewxdb_$DATE.zip"* 
> /var/lib/weewx/weewx.sdb
>
>
> # Introduce a short delay as a buffer (for example, 10 seconds). Adjust as 
> needed.
>
> sleep 10
>
>
> # Start weewx again
>
> sudo systemctl start weewx
>
> is this wrong or can It be improved?
>

-- 
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/1b6472b5-c52e-426b-abf1-1829719469c3n%40googlegroups.com.

Reply via email to