Skip to content

Instantly share code, notes, and snippets.

@luxuryluke
Forked from scottboms/update-site.sh
Last active May 21, 2020 07:30
Show Gist options
  • Save luxuryluke/5977d25417e109737c3c6feb95bce569 to your computer and use it in GitHub Desktop.
Save luxuryluke/5977d25417e109737c3c6feb95bce569 to your computer and use it in GitHub Desktop.
Simple rsync script to deploy a Kirby site over SSH with a non-standard port. Pair this with the `rsync-excludes.txt` https://gist.github.com/luxuryluke/b39d0d606e46e5fb015d81b1d7e0de26
#!/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