···1+#!/bin/bash
2+set -e
3+4+echo "Starting script"
5+6+# Restore the database if it does not already exist.
7+if [ -f /data/data.db ]; then
8+ echo "Database already exists, skipping restore"
9+else
10+ echo "No database found, restoring from replica if exists"
11+ litestream restore -if-replica-exists /data/data.db
12+fi
13+14+# Run litestream with your app as the subprocess.
15+exec litestream replicate -exec "/space"