18 lines
377 B
Bash
18 lines
377 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
if [[ "$(id -u)" -ne 0 ]]; then
|
|
echo "run as root" >&2
|
|
exit 1
|
|
fi
|
|
|
|
set -a
|
|
. /etc/kaotings/cms.env
|
|
set +a
|
|
stamp="$(date -u +%Y%m%dT%H%M%SZ)"
|
|
install -d -m 700 /home/flym/backups
|
|
output="/home/flym/backups/kaotings_cms_${stamp}.dump"
|
|
pg_dump --format=custom --file="$output" "$DATABASE_URI"
|
|
chmod 600 "$output"
|
|
stat -c "%s %n" "$output"
|