eeshugerman / postgres-backup-s3

A handy Docker container to periodically backup PostgreSQL to S3
MIT License
485 stars 167 forks source link

Not working when `SCHEDULE` env not set #6

Closed kandros closed 3 years ago

kandros commented 3 years ago

When not set the SCHEDULE env defaults an empty string, failing the check at

if [ -z "$SCHEDULE" ]; then
    # TODO: how to make CTRL-C work?
    echo "WARNING: $SCHEDULE is null. Going to sleep."
    tail -f /dev/null # do nothing forever
else
  exec go-cron "$SCHEDULE" /bin/sh backup.sh
fi

Resulting in the else clause to never run

eeshugerman commented 3 years ago

This is the intended behavior, more or less. If you don't set SCHEDULE, nothing happens unless you trigger a backup manually with docker exec. If you do SCHEDULE, the else clause will run.

kandros commented 3 years ago

Oh now I understand thanks.

Worth mentioning I was able to execute it right away setting command to ["sh", "backup.sh"] (my usecase was running the image only one in a kubernetes CronJob)