#!/bin/sh # Publishes the nkbmusic.com website staged in ~dev/nk-site to the Hestia web root. # Run as dev: sudo sh ~/APPS/nanga_kathai/server/deploy-site.sh set -e SRC=/home/dev/nk-site DEST=/home/user/web/nkbmusic.com/public_html [ -f "$SRC/index.html" ] && [ -f "$SRC/config.js" ] || { echo "Nothing staged in $SRC"; exit 1; } mkdir -p /home/dev/nk-site-backups tar -czf "/home/dev/nk-site-backups/public_html-$(date +%Y%m%d-%H%M%S).tgz" -C "$DEST" . rm -rf "${DEST:?}"/* cp -a "$SRC"/. "$DEST"/ chown -R user:user "$DEST" find "$DEST" -type d -exec chmod 755 {} + find "$DEST" -type f -exec chmod 644 {} + echo "Published to $DEST"