function cleanup_remote_tmp () {
if [[ "${REMOTE_HOST}" ]] && [[ "${REMOTE_DIR}" ]]
then
- echo "Clean up remote workdir."
+ echo "xremote: Clean up remote workdir."
ssh "${REMOTE_HOST}" "rm -rf \"${REMOTE_DIR}\""
fi
}
[[ "${REMOTE_DIR}" ]] && (exit "Remote host already defined!" >&2 && exit 1)
REMOTE_HOST="${value}"
[[ "${REMOTE_HOST}" ]] || REMOTE_HOST="${XREMOTE_HOST}"
- [[ "${REMOTE_HOST}" ]] || (echo "No remote host specified." >&2 && exit 1)
+ [[ "${REMOTE_HOST}" ]] || (echo "xremote: No remote host specified." >&2 && exit 1)
REMOTE_DIR="$(ssh </dev/null "${REMOTE_HOST}" mktemp -d /tmp/xremote.from_"$(hostname)_$(date +%Y%m%d-%H%M%S)".XXXXXX)"
;;
esac
tar c "${main}" | ssh "${REMOTE_HOST}" "cd \"${REMOTE_DIR}\" && tar mx"
-echo "On ${REMOTE_HOST}"
+echo "xremote: on ${REMOTE_HOST}"
if [[ "${REMOTE_EXEC}" ]]
then
REMOTE_COMMAND="./${main}"
fi
-echo "----------------------------------------------------------------------"
+echo "xremote: -- stdout ---------------------------------------------------"
ssh </dev/null "${REMOTE_HOST}" "cd \"${REMOTE_DIR}\" && ${REMOTE_COMMAND}"
-echo "----------------------------------------------------------------------"
######################################################################
# Disable globbing to keep wildcards for the remote side
+echo "xremote: -- retrieve results -----------------------------------------"
+
set -f
while read line
set +f
+echo "xremote: -- finished -------------------------------------------------"
+
######################################################################