Skip to content

Instantly share code, notes, and snippets.

@bmc08gt
Last active January 31, 2019 12:12
Show Gist options
  • Save bmc08gt/c5141f0bed37f43ea97dd7af151def25 to your computer and use it in GitHub Desktop.
Save bmc08gt/c5141f0bed37f43ea97dd7af151def25 to your computer and use it in GitHub Desktop.
mainframer remoteinclude patch on v2 bash script
--- mainframer.sh 2018-05-22 14:45:00.994801900 -0400
+++ mainframer_modified.sh 2018-08-23 21:15:57.943112200 -0400
@@ -30,6 +30,7 @@
COMMON_IGNORE_FILE="$CONFIG_DIR/ignore"
LOCAL_IGNORE_FILE="$CONFIG_DIR/localignore"
REMOTE_IGNORE_FILE="$CONFIG_DIR/remoteignore"
+REMOTE_INCLUDE_FILE="$CONFIG_DIR/remoteinclude"
function readConfigProperty {
grep "^${1}=" "$CONFIG_FILE" | cut -d'=' -f2
@@ -115,7 +116,7 @@
startTime="$(date +%s)"
set +e
- if ssh "$REMOTE_MACHINE" "echo 'set -e && cd '$PROJECT_DIR_ON_REMOTE_MACHINE' && echo \"$REMOTE_COMMAND\" && echo "" && $REMOTE_COMMAND' | bash" ; then
+ if ssh -tt "$REMOTE_MACHINE" "echo 'set -e && cd '$PROJECT_DIR_ON_REMOTE_MACHINE' && echo \"$REMOTE_COMMAND\" && echo "" && $REMOTE_COMMAND' | bash" ; then
REMOTE_COMMAND_SUCCESSFUL="true"
fi
set -e
@@ -148,9 +149,12 @@
COMMAND+="--exclude-from='$REMOTE_IGNORE_FILE' "
fi
+ if [ -f "$REMOTE_INCLUDE_FILE" ]; then
+ COMMAND+="--include-from='$REMOTE_INCLUDE_FILE' "
+ fi
+
COMMAND+="--rsh ssh $REMOTE_MACHINE:'$PROJECT_DIR_ON_REMOTE_MACHINE'/ ./"
eval "$COMMAND"
-
endTime="$(date +%s)"
echo "Sync done: took $(formatTime $((endTime-startTime)))."
}
@@ -170,6 +174,7 @@
if [ "$REMOTE_COMMAND_SUCCESSFUL" == "true" ]; then
echo "Success: took $(formatTime $DURATION)."
+ exit 0
else
echo "Failure: took $(formatTime $DURATION)."
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment