Skip to content

Instantly share code, notes, and snippets.

@vemacs
Created October 17, 2015 01:45
Show Gist options
  • Select an option

  • Save vemacs/facbf933c278652f6219 to your computer and use it in GitHub Desktop.

Select an option

Save vemacs/facbf933c278652f6219 to your computer and use it in GitHub Desktop.
#!/bin/bash
source $1
INSTANCE=$2
INSTANCE_DEST="${DEPLOY_ROOT}${NAME}${INSTANCE}"
rsync -a --exclude ".*/" --delete "${MASTER}/" "${INSTANCE_DEST}/"
PORT=$(($PORT_START+$INSTANCE))
echo "Deploying with port ${PORT}"
SERVER_PROPS="${INSTANCE_DEST}/server.properties"
sed -i '/^server-port/d' "${SERVER_PROPS}"
echo "" >> "${SERVER_PROPS}"
echo "server-port=${PORT}" >> "${SERVER_PROPS}"
echo "Replacing variables with instance number"
find ${INSTANCE_DEST} -name '*.yml' -type f -print0 | xargs -0 sed -i "s/LOBBY_INSTANCE_NUM/${INSTANCE}/g"
find ${INSTANCE_DEST} -name '*.txt' -type f -print0 | xargs -0 sed -i "s/LOBBY_INSTANCE_NUM/${INSTANCE}/g"
sed -i -e "s/LOBBY_INSTANCE_NUM/${INSTANCE}/g" ${SERVER_PROPS}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment