#!/bin/bash

source ./.env.prod.pcb

msg="*** Sincronizza la Cartella UPLOAD dal Server $SERVERDIR_WEBSITE in LOCALE (Y/N) ? "

if [ "$1" = "" ]; then
  read -p "$msg" risposta
else
  risposta=$1
fi

cp .env.production .env.prod.bak
cp .env.prod.pcb .env.production

sleep 1


echo "Sincronizzazione $SERVERDIR_WEBSITE/upload ..."
rsync -avz -e 'ssh -p 8822' pcbuser@pcb:$SERVERDIR_WEBSITE/upload/ upload/
rsync -avz -e 'ssh -p 8822' pcbuser@pcb:$SERVERDIR_WEBSITE/upload/ public/upload/

cp .env.prod.bak .env.production

sleep 1

echo "Finito $SERVERDIR_WEBSITE"
