I figured out content syncing from live server to local. Change the bash script:
#!/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 "Running content sync from live dry-run"
rsync --dry-run -az --force --delete --progress --exclude-from=rsync_exclude.txt -e "ssh -p22" exampleuser@11.22.3.444:/var/www/vhosts/example.com/httpdocs/content/ ./public/content/
elif [[ "$2" == "go" ]]
then
echo "Running content sync from live actual"
rsync -az --force --delete --progress --exclude-from=rsync_exclude.txt -e "ssh -p22" exampleuser@11.22.3.444:/var/www/vhosts/example.com/httpdocs/content/ ./public/content/
else
echo "$ERRORSTRING";
fi
elif [[ "$1" == "live" ]]
then
if [[ -z $2 ]]
then
echo "Running live dry-run"
rsync --dry-run -az --force --delete --progress --exclude-from=rsync_exclude.txt -e "ssh -p22" ./public/ exampleuser@11.22.3.444:/var/www/vhosts/example.com/httpdocs
elif [[ "$2" == "go" ]]
then
echo "Running live actual deploy"
rsync -az --force --delete --progress --exclude-from=rsync_exclude.txt -e "ssh -p22" ./public/ exampleuser@11.22.3.444:/var/www/vhosts/example.com/httpdocs
else
echo "$ERRORSTRING";
fi
elif [[ "$1" == "staging" ]]
then
if [[ -z $2 ]]
then
echo "Running staging dry-run"
rsync --dry-run -az --force --delete --progress --exclude-from=rsync_exclude.txt -e "ssh -p22" ./public/ exampleuser@11.22.3.444:/var/www/vhosts/example.com/subdomains/test.example.com
elif [[ "$2" == "go" ]]
then
echo "Running staging actual deploy"
rsync -az --force --delete --progress --exclude-from=rsync_exclude.txt -e "ssh -p22" ./public/ exampleuser@11.22.3.444:/var/www/vhosts/example.com/subdomains/test.example.com
else
echo "$ERRORSTRING";
fi
fi
Also add these lines to your package.json
:
"content:sync:sim": "./deploy sync",
"content:sync": "./deploy sync go"