Automated Backups

How to setup automated backups of the Everdo database.

Overview

To back up the database while the app is running you need to use the sqlite3 tool - the official client for working with SQlite databases.

Setting up automated SQLite backups

  1. Create a backup script and make it executable.
  2. Test the script - make sure a backup is created and stored where you expect.
  3. Schedule the script to run periodically, for example as a cron job or as a scheduled task on Windows.

Here is a simple backup script. You need to replace /home/user with you unix user directory.

#!/bin/bash

TIMESTAMP=$(date +%F_%T | tr ':' '-')

sqlite3 /home/user/.config/everdo/db ".backup '/home/user/.config/everdo/backups/db_backup_$TIMESTAMP.sqlite'"

A more robust script that will retry the backup command up to 9 times if the first backup attempt fails. Credit to Christian.

#!/bin/bash

counter=0
while [ $counter -lt 9 ]
do
/usr/bin/sqlite3 /home/user/.config/everdo/db ".backup '/home/user/.config/everdo/backups/db_backup_$(date +%F_%T | tr ':' '-').sqlite'"
return_value=$?
if [ $return_value -eq 0 ]; then
counter=9
else
counter=$(( $counter + 1 ))
fi
done
Last modified March 31, 2021