15 lines
498 B
Bash
15 lines
498 B
Bash
|
#!/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/data/media/user/ $HOME/var/rollback/media_clean/user/
|
|||
|
|
|||
|
echo "creating the dump..."
|
|||
|
pg_dump -Fc -U $dbuser -d $db > $dump
|