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)