Last active
March 25, 2016 04:53
-
-
Save dreness/6f01a3c0f4ffb9b2ae45 to your computer and use it in GitHub Desktop.
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 | |
# extra verbose | |
set -x | |
# sync mods from local host to remote host (e.g. a minecraft server) | |
# optionally delete extraneous files in the remote mods directory | |
# Go home to allow relative paths below, but remember current dir. | |
pushd ~ | |
# local mods directory, do not escape spaces | |
LOCAL_MODS="Library/Application Support/minecraft/mods/" | |
# remote mods directory. DO escape spaces "like\ this" | |
REMOTE_MODS="minecraft-server/mods/" | |
# remote host name (or ssh_config entity name) | |
REMOTE_HOST="example.com" | |
# Set OPTS to "--delete-after" to delete extraneous files from the remote side | |
# Add "-n" for dry-run mode | |
# OPTS="--delete-after -n" | |
# OPTS="--delete-after" | |
# Setting this to empty string here to strongly encourage you to make sure you don't set | |
# --delete-after until you are *sure* you have the directories configured correctly. | |
# Specifying the wrong remote directory will have the side effect of deleting everything | |
# that isn't a minecraft mod from that directory, so don't get it wrong. On the other hand, | |
# deleting the old version of the mod is a required part of the workflow. Just be careful :) | |
OPTS="" | |
# --delete-after only works on directories (no globbing for contents) | |
rsync -avz ${OPTS} "${LOCAL_MODS}" $REMOTE_HOST:"${REMOTE_MODS}" | |
# as you were... | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment