2015-02-01 20:46:06 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# SSH only allowed to localhost/lo
|
2015-03-22 00:51:30 +00:00
|
|
|
# --retries if ssh dies
|
2015-04-09 23:20:51 +00:00
|
|
|
cat <<'EOF' | sed -e s/\$SERVER1/$SERVER1/\;s/\$SERVER2/$SERVER2/ | parallel -vj1 --retries 2 -k --joblog /tmp/jl-`basename $0` -L1
|
2015-02-01 20:46:06 +00:00
|
|
|
echo '### zsh'
|
|
|
|
ssh zsh@lo 'fun="() { echo function from zsh to zsh \$*; }";
|
|
|
|
export fun;
|
|
|
|
parallel --env fun fun ::: OK'
|
|
|
|
|
|
|
|
ssh zsh@lo 'fun="() { echo function from zsh to bash \$*; }";
|
|
|
|
export fun;
|
|
|
|
parallel -S parallel@lo --env fun fun ::: OK'
|
|
|
|
|
|
|
|
echo '### csh'
|
|
|
|
echo "3 big vars run remotely - length(base64) > 1000"
|
2015-06-21 08:39:48 +00:00
|
|
|
stdout ssh csh@lo 'setenv A `seq 200|xargs`;
|
|
|
|
setenv B `seq 200 -1 1|xargs`;
|
|
|
|
setenv C `seq 300 -2 1|xargs`;
|
|
|
|
parallel -Scsh@lo --env A,B,C -k echo \$\{\}\|wc ::: A B C'
|
2015-06-21 17:40:58 +00:00
|
|
|
echo '### csh2'
|
2015-02-01 20:46:06 +00:00
|
|
|
echo "3 big vars run locally"
|
2015-06-21 08:39:48 +00:00
|
|
|
stdout ssh csh@lo 'setenv A `seq 200|xargs`;
|
|
|
|
setenv B `seq 200 -1 1|xargs`;
|
|
|
|
setenv C `seq 300 -2 1|xargs`;
|
|
|
|
parallel --env A,B,C -k echo \$\{\}\|wc ::: A B C'
|
2015-02-01 20:46:06 +00:00
|
|
|
|
2015-02-22 14:09:26 +00:00
|
|
|
echo '### Test tmux works on different shells'
|
|
|
|
parallel -Scsh@lo,tcsh@lo,parallel@lo,zsh@lo --tmux echo ::: 1 2 3 4; echo $?
|
|
|
|
parallel -Scsh@lo,tcsh@lo,parallel@lo,zsh@lo --tmux false ::: 1 2 3 4; echo $?
|
|
|
|
|
|
|
|
export PARTMUX='parallel -Scsh@lo,tcsh@lo,parallel@lo,zsh@lo --tmux ';
|
2015-03-16 18:51:08 +00:00
|
|
|
stdout ssh zsh@lo "$PARTMUX" 'true ::: 1 2 3 4; echo $status' | grep -v 'See output';
|
|
|
|
stdout ssh zsh@lo "$PARTMUX" 'false ::: 1 2 3 4; echo $status' | grep -v 'See output';
|
|
|
|
stdout ssh parallel@lo "$PARTMUX" 'true ::: 1 2 3 4; echo $?' | grep -v 'See output';
|
|
|
|
stdout ssh parallel@lo "$PARTMUX" 'false ::: 1 2 3 4; echo $?' | grep -v 'See output';
|
|
|
|
stdout ssh tcsh@lo "$PARTMUX" 'true ::: 1 2 3 4; echo $status' | grep -v 'See output';
|
2015-06-21 17:40:58 +00:00
|
|
|
stdout ssh tcsh@lo "$PARTMUX" 'false ::: 1 2 3 4; echo $status' | grep -v 'See output';
|
|
|
|
stdout ssh csh@lo "$PARTMUX" 'true ::: 1 2 3 4; echo $status' | grep -v 'See output';
|
|
|
|
stdout ssh csh@lo "$PARTMUX" 'false ::: 1 2 3 4; echo $status' | grep -v 'See output'
|
2015-02-22 14:09:26 +00:00
|
|
|
|
|
|
|
echo '### works'
|
2015-03-16 18:51:08 +00:00
|
|
|
stdout parallel -Sparallel@lo --tmux echo ::: \\\\\\\"\\\\\\\"\\\;\@ | grep -v 'See output'
|
|
|
|
stdout parallel -Sparallel@lo --tmux echo ::: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | grep -v 'See output'
|
2015-02-22 14:09:26 +00:00
|
|
|
|
|
|
|
echo '### These blocked due to length'
|
2015-03-16 18:51:08 +00:00
|
|
|
stdout parallel -Slo --tmux echo ::: \\\\\\\"\\\\\\\"\\\;\@ | grep -v 'See output'
|
|
|
|
stdout parallel -Scsh@lo --tmux echo ::: \\\\\\\"\\\\\\\"\\\;\@ | grep -v 'See output'
|
|
|
|
stdout parallel -Stcsh@lo --tmux echo ::: \\\\\\\"\\\\\\\"\\\;\@ | grep -v 'See output'
|
|
|
|
stdout parallel -Szsh@lo --tmux echo ::: \\\\\\\"\\\\\\\"\\\;\@ | grep -v 'See output'
|
|
|
|
stdout parallel -Scsh@lo --tmux echo ::: 111111111111111111111111111111111111111111111111111111111 | grep -v 'See output'
|
2015-02-22 14:09:26 +00:00
|
|
|
|
2015-03-07 22:22:10 +00:00
|
|
|
echo '### bug #43746: --transfer and --return of multiple inputs {1} and {2}'
|
2015-03-07 22:41:45 +00:00
|
|
|
echo '### and:'
|
|
|
|
echo '### bug #44371: --trc with csh complains'
|
2015-03-07 22:22:10 +00:00
|
|
|
cd /tmp; echo 1 > file1; echo 2 > file2;
|
2015-03-07 22:41:45 +00:00
|
|
|
parallel -Scsh@lo --trc {1}.a --trc {2}.b 'echo A {1} > {1}.a; echo B {2} > {2}.b' ::: file1 ::: file2;
|
2015-03-07 22:22:10 +00:00
|
|
|
cat file1.a file2.b;
|
|
|
|
rm /tmp/file1 /tmp/file2 /tmp/file1.a /tmp/file2.b
|
2015-02-22 14:09:26 +00:00
|
|
|
|
2015-03-08 00:10:24 +00:00
|
|
|
echo '### bug #44143: csh and nice'
|
|
|
|
parallel --nice 1 -S csh@lo setenv B {}\; echo '$B' ::: OK
|
|
|
|
|
2015-07-19 01:07:48 +00:00
|
|
|
echo '### bug #45575: -m and multiple hosts repeats first args'
|
|
|
|
seq 1 3 | parallel -X -S 2/lo,2/: -k echo
|
|
|
|
|
2015-02-01 20:46:06 +00:00
|
|
|
EOF
|
2015-05-21 21:02:55 +00:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo "### Fish environment"
|
2015-07-22 06:28:05 +00:00
|
|
|
stdout ssh -q fish@lo <<'EOS' | egrep -v 'Welcome to |packages can be updated.'
|
2015-05-21 21:02:55 +00:00
|
|
|
alias alias_echo=echo;
|
|
|
|
function func_echo
|
|
|
|
echo $argv;
|
|
|
|
end
|
|
|
|
function env_parallel
|
|
|
|
setenv PARALLEL_ENV (functions -n | perl -pe 's/,/\n/g' | while read d; functions $d; end|perl -pe 's/\n/\001/')
|
|
|
|
parallel $argv;
|
|
|
|
set -e PARALLEL_ENV
|
|
|
|
end
|
|
|
|
env_parallel alias_echo ::: alias_works
|
|
|
|
env_parallel func_echo ::: function_works
|
|
|
|
env_parallel -S fish@lo alias_echo ::: alias_works_over_ssh
|
|
|
|
env_parallel -S fish@lo func_echo ::: function_works_over_ssh
|
|
|
|
EOS
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "### Zsh environment"
|
2015-07-22 06:28:05 +00:00
|
|
|
stdout ssh -q zsh@lo <<'EOS' | egrep -v 'Welcome to |packages can be updated.'
|
2015-05-21 21:02:55 +00:00
|
|
|
alias alias_echo=echo;
|
|
|
|
func_echo() {
|
|
|
|
echo $*;
|
|
|
|
}
|
|
|
|
env_parallel() {
|
|
|
|
PARALLEL_ENV="$(typeset -f)";
|
|
|
|
export PARALLEL_ENV
|
|
|
|
`which parallel` "$@";
|
|
|
|
unset PARALLEL_ENV;
|
|
|
|
}
|
|
|
|
env_parallel alias_echo ::: alias_does_not_work
|
|
|
|
env_parallel func_echo ::: function_works
|
|
|
|
env_parallel -S zsh@lo alias_echo ::: alias_does_not_work_over_ssh
|
|
|
|
env_parallel -S zsh@lo func_echo ::: function_works_over_ssh
|
|
|
|
EOS
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "### Ksh environment"
|
2015-07-22 06:28:05 +00:00
|
|
|
stdout ssh -q ksh@lo <<'EOS' | egrep -v 'Welcome to |packages can be updated.'
|
2015-05-21 21:02:55 +00:00
|
|
|
alias alias_echo=echo;
|
|
|
|
func_echo() {
|
|
|
|
echo $*;
|
|
|
|
}
|
|
|
|
env_parallel() {
|
2015-07-22 06:28:05 +00:00
|
|
|
export PARALLEL_ENV="$(alias | perl -pe 's/^/alias /';typeset -p|egrep -v 'typeset( -i)? -r|PIPESTATUS';typeset -f)";
|
2015-05-21 21:02:55 +00:00
|
|
|
`which parallel` "$@";
|
|
|
|
unset PARALLEL_ENV;
|
|
|
|
}
|
|
|
|
env_parallel alias_echo ::: alias_works
|
|
|
|
env_parallel func_echo ::: function_works
|
|
|
|
env_parallel -S ksh@lo alias_echo ::: alias_works_over_ssh
|
|
|
|
env_parallel -S ksh@lo func_echo ::: function_works_over_ssh
|
|
|
|
EOS
|
|
|
|
|