23 lines
775 B
Bash
23 lines
775 B
Bash
|
#!/bin/bash
|
|||
|
source $HOME/scripts/config.env
|
|||
|
|
|||
|
read -p "DANGER – everything including config.php 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
|
|||
|
|
|||
|
cd $HOME/nextcloud
|
|||
|
|
|||
|
$php occ maintenance:mode --on
|
|||
|
|
|||
|
echo "creating database dump..."
|
|||
|
pg_dump -Fc -U $dbuser -d $db > $HOME/var/db/nextcloud.dump
|
|||
|
|
|||
|
echo "syncing data..."
|
|||
|
rsync -aAX --delete /home/storage/$pac/users/$user/data/ /home/storage/$pac/users/$user/data_clean/
|
|||
|
echo "syncing nextcloud..."
|
|||
|
rsync -aAX --delete /home/pacs/$pac/users/$user/nextcloud/ /home/pacs/$pac/users/$user/nextcloud_clean/
|
|||
|
|
|||
|
$php occ maintenance:mode --off
|