Skip to content
Snippets Groups Projects
Commit 196ba2d6 authored by wu-lee's avatar wu-lee Committed by root
Browse files

mastodon_db_backup.sh - disable TTY on docker-compose; use pipefail

Script ran fine on the console, failed in cron job.  This is because
the docker-compose exec command was attempting (by default) to allocate
 a TTY, and failing.  This was also not being detected because the
default bash behaviour is to return the status of the last command
in a pipe (in this case, gzip). Enable pipefail option to prevent this.
parent b3745a20
No related tags found
No related merge requests found
#!/bin/bash
# A script which backs up the mastodon database(s)
set -o pipefail
set -e
container=db
backupdir=/opt/backups/postgres
......@@ -21,7 +23,7 @@ backup() {
rm -f $(readlink -f "$backupdir/$link")
# create new backup file
docker-compose -f /opt/social.coop/sauce/docker/docker-compose.yml exec "$cname" pg_dumpall -U postgres -c -v | gzip >"$backupdir/$file"
docker-compose -f /opt/social.coop/sauce/docker/docker-compose.yml exec -T "$cname" pg_dumpall -U postgres -c -v | gzip >"$backupdir/$file"
status=$?
# link the sequence number to it
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment