File: dump-db

package info (click to toggle)
openqa 5.1764349525.ffb594867-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,264 kB
  • sloc: perl: 57,599; sql: 26,462; javascript: 8,466; xml: 2,229; sh: 1,705; makefile: 443; python: 249
file content (8 lines) | stat: -rwxr-xr-x 447 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
#!/bin/bash
set -euo pipefail
DUMP_FOLDER=${DUMP_FOLDER:-"/var/lib/openqa/backup"}
DAYS_TO_KEEP=${DAYS_TO_KEEP:-"7"}
[[ ${1-} = '-h' ]] || [[ ${1-} = '--help' ]] && echo "Dump the openQA postgresql database to ${DUMP_FOLDER} and clean-up backups older than ${DAYS_TO_KEEP} days." && exit

ionice -c3 nice -n19 pg_dump -Fc -c openqa -f "${DUMP_FOLDER}/$(date -Idate).dump"
find -L "${DUMP_FOLDER}" -type f -mtime "+${DAYS_TO_KEEP}" -print0 -delete