Question

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
Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top