2010-05-30 22:30:01 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-12-26 22:29:28 +00:00
|
|
|
# SPDX-FileCopyrightText: 2021-2022 Ole Tange, http://ole.tange.dk and Free Software and Foundation, Inc.
|
2021-03-22 20:16:35 +00:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2010-05-30 22:30:01 +00:00
|
|
|
# TODO return multiple
|
|
|
|
|
2011-10-17 01:10:32 +00:00
|
|
|
SERVER1=parallel-server1
|
2010-05-30 22:30:01 +00:00
|
|
|
SERVER2=parallel-server2
|
2020-08-07 20:20:30 +00:00
|
|
|
SSHUSER1=vagrant
|
|
|
|
SSHUSER2=vagrant
|
|
|
|
#SSHLOGIN1=parallel@$SERVER1
|
|
|
|
#SSHLOGIN2=parallel@$SERVER2
|
|
|
|
SSHLOGIN1=$SSHUSER1@$SERVER1
|
|
|
|
SSHLOGIN2=$SSHUSER2@$SERVER2
|
2010-05-30 22:30:01 +00:00
|
|
|
|
|
|
|
echo '### Test --transfer --return --cleanup - files with newline'
|
|
|
|
|
|
|
|
rm -rf /tmp/parallel.file*
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 rm -rf 'tmp/parallel.file*' '/tmp/parallel.file*'
|
|
|
|
stdout ssh $SSHLOGIN2 rm -rf 'tmp/parallel.file*' '/tmp/parallel.file*'
|
2010-05-30 22:30:01 +00:00
|
|
|
|
|
|
|
cd /
|
|
|
|
echo '### --transfer - file with newline'
|
|
|
|
echo newline > '/tmp/parallel.file.
|
|
|
|
newline1'
|
|
|
|
echo newline > '/tmp/parallel.file.
|
|
|
|
newline2'
|
2013-03-24 16:24:59 +00:00
|
|
|
find tmp/parallel*newline* -print0 | stdout parallel -0 -k --transfer --sshlogin $SSHLOGIN1,$SSHLOGIN2 cat {}";"rm {}
|
2010-05-30 22:30:01 +00:00
|
|
|
# Should give: No such file or directory
|
|
|
|
echo good if no file
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 ls 'tmp/parallel.file*'
|
2010-05-30 22:30:01 +00:00
|
|
|
# Should give: No such file or directory
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN2 ls 'tmp/parallel.file*'
|
2010-05-30 22:30:01 +00:00
|
|
|
|
|
|
|
echo '### --transfer --cleanup - file with newline'
|
|
|
|
echo newline > '/tmp/parallel.file.
|
|
|
|
newline1'
|
|
|
|
echo newline > '/tmp/parallel.file.
|
|
|
|
newline2'
|
2013-03-24 16:24:59 +00:00
|
|
|
find tmp/parallel*newline* -print0 | stdout parallel -0 -k --transfer --cleanup --sshlogin $SSHLOGIN1,$SSHLOGIN2 cat {}
|
2010-05-30 22:30:01 +00:00
|
|
|
# Should give: No such file or directory
|
|
|
|
echo good if no file
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 ls 'tmp/parallel.file*'
|
2010-05-30 22:30:01 +00:00
|
|
|
# Should give: No such file or directory
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN2 ls 'tmp/parallel.file*'
|
2010-05-30 22:30:01 +00:00
|
|
|
|
|
|
|
echo '### --return - file with newline'
|
2010-10-26 23:50:58 +00:00
|
|
|
rm -rf /tmp/parallel.file.*newline*
|
2010-05-30 22:30:01 +00:00
|
|
|
echo newline > '/tmp/parallel.file.
|
|
|
|
newline1'
|
|
|
|
echo newline > '/tmp/parallel.file.
|
|
|
|
newline2'
|
2013-03-24 16:24:59 +00:00
|
|
|
find tmp/parallel*newline* -print0 | stdout parallel -0 -k --return {}.out --sshlogin $SSHLOGIN1,$SSHLOGIN2 mkdir -p tmp\;echo remote '>' {}.out
|
2010-05-30 22:30:01 +00:00
|
|
|
ls tmp/parallel*newline*out
|
|
|
|
rm tmp/parallel*newline*out
|
|
|
|
# Cleanup remote
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 rm -rf 'tmp/parallel.file*'
|
|
|
|
stdout ssh $SSHLOGIN2 rm -rf 'tmp/parallel.file*'
|
2010-05-30 22:30:01 +00:00
|
|
|
|
|
|
|
echo '### --return --cleanup - file with newline'
|
|
|
|
echo newline > '/tmp/parallel.file.
|
|
|
|
newline1'
|
|
|
|
echo newline > '/tmp/parallel.file.
|
|
|
|
newline2'
|
2013-03-24 16:24:59 +00:00
|
|
|
find tmp/parallel*newline* -print0 | stdout parallel -0 -k --return {}.out --cleanup --sshlogin $SSHLOGIN1,$SSHLOGIN2 echo remote '>' {}.out
|
2010-05-30 22:30:01 +00:00
|
|
|
ls tmp/parallel*newline*out
|
|
|
|
rm tmp/parallel*newline*out
|
|
|
|
echo good if no file
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 ls 'tmp/parallel.file*' || echo OK
|
2010-05-30 22:30:01 +00:00
|
|
|
# Should give: No such file or directory
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN2 ls 'tmp/parallel.file*' || echo OK
|
2010-05-30 22:30:01 +00:00
|
|
|
|
|
|
|
echo '### --transfer --return --cleanup - file with newline'
|
|
|
|
echo newline > '/tmp/parallel.file.
|
|
|
|
newline1'
|
|
|
|
echo newline > '/tmp/parallel.file.
|
|
|
|
newline2'
|
2013-03-24 16:24:59 +00:00
|
|
|
find tmp/parallel*newline* -print0 | stdout parallel -0 -k --transfer --return {}.out --cleanup --sshlogin $SSHLOGIN1,$SSHLOGIN2 cat {} '>' {}.out
|
2010-05-30 22:30:01 +00:00
|
|
|
ls tmp/parallel*newline*out
|
|
|
|
rm tmp/parallel*newline*out
|
|
|
|
echo good if no file
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 ls 'tmp/parallel.file*' || echo OK
|
2010-05-30 22:30:01 +00:00
|
|
|
# Should give: No such file or directory
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN2 ls 'tmp/parallel.file*' || echo OK
|
2010-05-30 22:30:01 +00:00
|
|
|
|
|
|
|
echo '### --trc - file with newline'
|
|
|
|
echo newline > '/tmp/parallel.file.
|
|
|
|
newline1'
|
|
|
|
echo newline > '/tmp/parallel.file.
|
|
|
|
newline2'
|
2013-03-24 16:24:59 +00:00
|
|
|
find tmp/parallel*newline* -print0 | stdout parallel -0 -k --trc {}.out --sshlogin $SSHLOGIN1,$SSHLOGIN2 cat {} '>' {}.out
|
2010-05-30 22:30:01 +00:00
|
|
|
ls tmp/parallel*newline*out
|
|
|
|
rm tmp/parallel*newline*out
|
|
|
|
echo good if no file
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 ls 'tmp/parallel.file*' || echo OK
|
2010-05-30 22:30:01 +00:00
|
|
|
# Should give: No such file or directory
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN2 ls 'tmp/parallel.file*' || echo OK
|
2010-05-30 22:30:01 +00:00
|
|
|
|
|
|
|
echo '### --trc - multiple file with newline'
|
|
|
|
echo newline > '/tmp/parallel.file.
|
|
|
|
newline1'
|
|
|
|
echo newline > '/tmp/parallel.file.
|
|
|
|
newline2'
|
2013-03-24 16:24:59 +00:00
|
|
|
find tmp/parallel*newline* -print0 | stdout parallel -0 -k --trc {}.out --trc {}.out2 --sshlogin $SSHLOGIN1,$SSHLOGIN2 cat {} '>' {}.out';'cat {} '>' {}.out2
|
2010-05-30 22:30:01 +00:00
|
|
|
ls tmp/parallel*newline*out*
|
|
|
|
rm tmp/parallel*newline*out*
|
|
|
|
echo good if no file
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 ls 'tmp/parallel.file*' || echo OK
|
2010-05-30 22:30:01 +00:00
|
|
|
# Should give: No such file or directory
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN2 ls 'tmp/parallel.file*' || echo OK
|
2010-05-30 22:30:01 +00:00
|
|
|
|
|
|
|
echo '### Test use special ssh'
|
|
|
|
echo 'ssh "$@"; echo "$@" >>/tmp/myssh1-run' >/tmp/myssh1
|
|
|
|
echo 'ssh "$@"; echo "$@" >>/tmp/myssh2-run' >/tmp/myssh2
|
|
|
|
chmod 755 /tmp/myssh1 /tmp/myssh2
|
|
|
|
rm -rf /tmp/myssh1-run /tmp/myssh2-run
|
|
|
|
echo newline > '/tmp/parallel.file.
|
|
|
|
newline1'
|
|
|
|
echo newline > '/tmp/parallel.file.
|
|
|
|
newline2'
|
2013-03-24 16:24:59 +00:00
|
|
|
find tmp/parallel*newline* -print0 | stdout parallel -0 -k -j1 --trc {}.out --trc {}.out2 \
|
2011-10-17 01:10:32 +00:00
|
|
|
--sshlogin "/tmp/myssh1 $SSHLOGIN1, /tmp/myssh2 $SSHLOGIN2" \
|
2010-05-30 22:30:01 +00:00
|
|
|
cat {} '>' {}.out';'cat {} '>' {}.out2
|
|
|
|
ls tmp/parallel*newline*out*
|
|
|
|
rm tmp/parallel*newline*out*
|
|
|
|
echo good if no file
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 ls 'tmp/parallel.file*' || echo OK
|
2010-05-30 22:30:01 +00:00
|
|
|
# Should give: No such file or directory
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN2 ls 'tmp/parallel.file*' || echo OK
|
2010-10-26 23:50:58 +00:00
|
|
|
echo 'Input for ssh'
|
2015-01-02 12:07:44 +00:00
|
|
|
cat /tmp/myssh1-run /tmp/myssh2-run | perl -pe 's/(PID.)\d+/${1}00000/g;s/(SEQ[ =]|line)\d/$1X/g;' |
|
2018-08-22 22:21:29 +00:00
|
|
|
perl -pe 's/\S*parallel-server\S*/one-server/;s:\S[a-zA-Z0-9/\\+=]{500,}\S:base64:;'
|
2010-05-30 22:30:01 +00:00
|
|
|
rm /tmp/myssh1-run /tmp/myssh2-run
|
|
|
|
|
2015-02-01 13:38:26 +00:00
|
|
|
rm -rf /tmp/parallel.file*
|
|
|
|
rm /tmp/myssh1 /tmp/myssh2
|