hs.scripts/rollback/synapse/setstate.sh
2024-04-25 13:49:12 +02:00

15 lines
503 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
source $HOME/scripts/config.env
read -p "DANGER uploads & database will be made permanent. Proceed? (Yy)" -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 # https://stackoverflow.com/questions/1885525/how-do-i-prompt-a-user-for-confirmation-in-bash-script
fi
echo "syncing data..."
rsync -aAX --delete $HOME/synapse/media_store/ $HOME/var/rollback/media_store_clean/
echo "creating the dump..."
pg_dump -Fc -U $dbuser -d $db > $dump