From 8e2f0ae340280a844ee46604764919feadeaf3b8 Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Fri, 6 Feb 2026 12:09:36 +1100 Subject: [PATCH] take into account ENV var for snapshots --- crontab | 2 +- snapshot.sh | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/crontab b/crontab index 1abbaf6..062f54e 100644 --- a/crontab +++ b/crontab @@ -1,2 +1,2 @@ # run once every 5 days or so -0 23 2-27/5 * * finplan /code/snapshot.sh +0 23 2-27/5 * * finplan cd /tmp && ENV="production" /code/snapshot.sh diff --git a/snapshot.sh b/snapshot.sh index 5ba5a80..5f80981 100755 --- a/snapshot.sh +++ b/snapshot.sh @@ -1,6 +1,10 @@ #!/bin/bash -DB_FILE="finance.db" +if [ "$ENV" == "production" ]; then + DB_FILE="/data/finance.db" +else + DB_FILE="./finance.db" +fi HISTORY_TABLE="finance_history" # Current date in the format you've been using DATE_STR=$(date +%Y-%m-%d)