hs.scripts/rollback/restore.sh

24 lines
463 B
Bash
Raw Normal View History

2024-04-25 13:49:12 +02:00
#/bin/bash
set -e
app=keycloak # service and (optional) dumpfile name
db=db123_user
user=$db
dump=$HOME/var/db/$app.dump
# ensure systemctl --user works
export XDG_RUNTIME_DIR=/run/user/$UID
echo "stopping $app..."
systemctl stop --user $app
echo "restoring database..."
# -c drops all objects that are to be restored
pg_restore -c -h localhost -U $user -d $db < $dump
systemctl start --user $app
echo "started $app..."
sleep 2
systemctl status --user $app