Skip to content

Instantly share code, notes, and snippets.

@scottboms
Created April 17, 2020 18:17
Show Gist options
  • Save scottboms/f62286fe55e207addc1f6e0ad79f5db6 to your computer and use it in GitHub Desktop.
Save scottboms/f62286fe55e207addc1f6e0ad79f5db6 to your computer and use it in GitHub Desktop.
Simple rsync script to deploy a Kirby site over SSH with a non-standard port.
#!/bin/bash
ERRORST="Whoops! Maybe check the command and try that again."
if [ $# -eq 0 ]
then
echo "$ERRORST";
elif [[ "$1" == "help" ]]
then
echo "To run: update-site.sh deploy OR update-site.sh deploy go"
elif [[ "$1" == "deploy" ]]
then
if [[ -z $2 ]]
then
echo "Running deploy dry-run (no live changes)"
rsync --dry-run -az --force --delete --progress --exclude-from=rsync-excludes.txt -e "ssh -p 30000" ./ user@IP-ADDRESS:/path/on/server/
elif [[ "$2" == "go" ]]
then
echo "Running deploy for reals"
rsync -az --force --delete --progress --exclude-from=rsync-excludes.txt -e "ssh -p 30000" ./ user@IP-ADDRESS:/path/on/server/
else
echo "$ERRORST";
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment