#!/usr/bin/env bash # Sincronizza codice produzione (questa cartella) verso ambiente DEV # Uso: ./scripts/sync-to-dev.sh [--dry-run] set -euo pipefail DRY="" if [[ "${1:-}" == "--dry-run" ]]; then DRY="--dry-run"; fi SRC="/var/www/netgescon" # produzione (runtime) DST="/home/michele/netgescon/netgescon-laravel" # dev backup EXCLUDES=( ".git/" "vendor/" "node_modules/" "storage/logs/" "storage/framework/cache/" "storage/framework/views/" "public/storage/" "*.log" "scripts/sync-to-prod.sh" "scripts/sync-to-dev.sh" ) EX_ARGS=() for e in "${EXCLUDES[@]}"; do EX_ARGS+=("--exclude=${e}"); done rsync -a --delete ${DRY} "${EX_ARGS[@]}" "$SRC/" "$DST/" echo "Sync to DEV completato ${DRY:+(dry-run)}"