Created
October 31, 2012 08:03
-
-
Save kehh/3985742 to your computer and use it in GitHub Desktop.
Warsync - a tool for speeding up rsync of war files by unzipping them on the source and target and then rsyncing the diffs
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 | |
#Warsync - a tool for speeding up rsync of war files by unzipping them on the source and target and then rsyncing the diffs | |
echo "Usage: $0 source.war destinationserver" | |
CURRENTDIR=$PWD | |
WARFILE="$CURRENTDIR/$1" | |
REMOTEHOST=$2 | |
CURRENTUSER=$USER | |
REMOTEHOME="/home/$CURRENTUSER" | |
WARFILENAME=`basename $1` | |
echo "source is $WARFILE target is $TARGET" | |
TEMPBASE="/tmp/warsync/" | |
TEMPDIR="$TEMPBASE/$WARFILENAME" | |
mkdir -p "$TEMPDIR" | |
cd "$TEMPDIR" | |
jar -xvf "$WARFILE" | |
ssh $REMOTEHOST "mkdir -p \"$TEMPDIR\";cd \"$TEMPDIR\";REMOTEDIR=\"$PWD\";pwd;jar -xvf \"$REMOTEHOME/$WARFILENAME\""rsync -avz --human-readable --progress --delete "$TEMPDIR" $REMOTEHOST:"$TEMPBASE" | |
ssh $REMOTEHOST "jar -cvf \"$WARFILENAME\" -C \"$TEMPDIR\" ./;" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment