projects
/
xremote.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d3573a6
)
Added the -r option to specify where to download result files.
author
Francois Fleuret
<francois@fleuret.org>
Mon, 30 Dec 2019 08:42:49 +0000
(09:42 +0100)
committer
Francois Fleuret
<francois@fleuret.org>
Mon, 30 Dec 2019 08:42:49 +0000
(09:42 +0100)
xremote.sh
patch
|
blob
|
history
diff --git
a/xremote.sh
b/xremote.sh
index
7ebc0d4
..
478a773
100755
(executable)
--- a/
xremote.sh
+++ b/
xremote.sh
@@
-35,7
+35,7
@@
function check_remote_is_defined () {
function help () {
cat <<EOF
function help () {
cat <<EOF
-xremote.sh [--help] [-h <remote_host>] [-d <remote_dir>] [-i] <script> [script arguments]
+xremote.sh [--help] [-h <remote_host>] [-d <remote_dir>] [-
r <local_result_dir>] [-
i] <script> [script arguments]
This script takes a script as argument and executes it remotely in a
temporary directory on a ssh-accessible server.
This script takes a script as argument and executes it remotely in a
temporary directory on a ssh-accessible server.
@@
-69,6
+69,9
@@
xremote.sh [--help] [-h <remote_host>] [-d <remote_dir>] [-i] <script> [script a
scripts run in the specified directory on the remote host, but the
main executable and post-run commands are ignored
scripts run in the specified directory on the remote host, but the
main executable and post-run commands are ignored
+ If the -r option is provided, the result files specified with
+ @XREMOTE_GET will be downloaded there.
+
If no argument is provided to @XREMOTE_HOST, and the -h option is
not specified, the environment variable \$XREMOTE_HOST is used
instead
If no argument is provided to @XREMOTE_HOST, and the -h option is
not specified, the environment variable \$XREMOTE_HOST is used
instead
@@
-117,6
+120,13
@@
do
echo "xremote: no run"
;;
echo "xremote: no run"
;;
+ -r)
+ shift
+ ARG_RESULT_DIR="$1"
+ [[ ${ARG_RESULT_DIR} ]] || (echo "xremote: Directory missing." && exit 1)
+ echo "xremote: result dir set to ${ARG_RESULT_DIR}"
+ ;;
+
--help)
help
exit 0
--help)
help
exit 0
@@
-243,6
+253,13
@@
echo "xremote: -- retrieving files -----------------------------------------"
set -f
set -f
+if [[ "${ARG_RESULT_DIR}" ]]
+then
+ RESULT_DIR="${ARG_RESULT_DIR}"
+else
+ RESULT_DIR="."
+fi
+
while read line
do
if [[ "${line}" =~ '@XREMOTE' ]]
while read line
do
if [[ "${line}" =~ '@XREMOTE' ]]
@@
-258,7
+275,7
@@
do
GET)
check_remote_is_defined
GET)
check_remote_is_defined
- ssh </dev/null "${REMOTE_HOST}" "cd \"${REMOTE_DIR}\" && tar 2>/dev/null c ${value}" | tar mxv
+ ssh </dev/null "${REMOTE_HOST}" "cd \"${REMOTE_DIR}\" && tar 2>/dev/null c ${value}" | tar mxv
-C "${RESULT_DIR}"
;;
esac
fi
;;
esac
fi