Website/deploy_website.sh
2025-03-16 21:03:11 -04:00

25 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# deploy_website.sh
# This script synchronizes your local Hugo-generated website content
# from /home/danesabo/Projects/Website/public to your remote server "saboserver"
# at the target directory /srv/www using rsync over SSH.
# Define the local source directory.
LOCAL_DIR="/home/danesabo/Projects/Website/public"
# Define the remote host name (pre-configured in your SSH config as 'saboserver').
REMOTE_HOST="saboserver"
# Define the remote target directory.
REMOTE_DIR="/srv/www"
# The rsync command explanation:
# -a : Archive mode (preserves symbolic links, permissions, timestamps, etc.)
# -v : Verbose output to show progress.
# -z : Compress file data during the transfer.
# --delete : Remove files from the destination that no longer exist in the source.
# -e ssh : Use SSH for the data transfer.
# The trailing slash in "${LOCAL_DIR}/" ensures that only the contents of the folder are copied,
# rather than the folder itself.
rsync -avz --delete -e ssh "${LOCAL_DIR}/" "${REMOTE_HOST}:${REMOTE_DIR}/"