Created
March 2, 2023 11:01
-
-
Save HashandSalt/0c775b1c73cc08274cd4d0c808f01323 to your computer and use it in GitHub Desktop.
Deploynment script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ERRORSTRING="Whoops! That didn't work. Please check the command you ran." | |
if [ $# -eq 0 ] | |
then | |
echo "$ERRORSTRING"; | |
elif [[ "$1" == "sync" ]] | |
then | |
if [[ -z $2 ]] | |
then | |
echo "Live Content Sync: DRY RUN" | |
rsync --dry-run -azLK --force --delete --progress --exclude-from=rsync_exclude.txt -e "ssh -p22" user@11.22.3.123:/var/www/vhosts/domain.com/ ./public/content/ | |
elif [[ "$2" == "go" ]] | |
then | |
echo "Live Content Sync: REAL" | |
rsync -azLK --force --delete --progress --exclude-from=rsync_exclude.txt -e "ssh -p22" user@11.22.3.123:/var/www/vhosts/domain.com/ ./public/content/ | |
else | |
echo "$ERRORSTRING"; | |
fi | |
elif [[ "$1" == "live" ]] | |
then | |
if [[ -z $2 ]] | |
then | |
echo "Staging Deploy: DRY RUN" | |
rsync --dry-run -azLK --force --delete --progress --exclude-from=rsync_exclude.txt -e "ssh -p22" ./public/ user@11.22.3.123:/var/www/vhosts/domain.com/ | |
elif [[ "$2" == "go" ]] | |
then | |
echo "Live Deploy: REAL" | |
rsync -azLK --force --delete --progress --exclude-from=rsync_exclude.txt -e "ssh -p22" ./public/ user@11.22.3.123:/var/www/vhosts/domain.com/ | |
else | |
echo "$ERRORSTRING"; | |
fi | |
elif [[ "$1" == "staging" ]] | |
then | |
if [[ -z $2 ]] | |
then | |
echo "Staging Deploy: DRY RUN" | |
rsync --dry-run -azLK --force --delete --progress --exclude-from=rsync_exclude.txt -e "ssh -p22" ./public/ user@11.22.3.123:/var/www/vhosts/domain.com/ | |
elif [[ "$2" == "go" ]] | |
then | |
echo "Staging Deploy: REAL" | |
rsync -azLK --force --delete --progress --exclude-from=rsync_exclude.txt -e "ssh -p22" ./public/ user@11.22.3.123:/var/www/vhosts/domain.com/ | |
else | |
echo "$ERRORSTRING"; | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment