I'm trying to back up my db using a BASH script while having an application use it at the same time.

The application is not a heavy write application.

I've seen different solutions on SO, but want to confirm the correct way. I want users the ability to read at any time during the backup, writing is not a concern since I do all the writing (blog app).

Are there any dangers in corruption using:

sqlite3 /var/www/ghost/content/data/ghost.db <<EOF
.timeout 20000
.backup tmp.db
EOF
有帮助吗?

解决方案

The .backup command uses SQLite's backup API, which is designed for online backups.

As long as you do not do have broken hardware or software (which has nothing to with backups and would affect any writes), this will work fine.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top