2011-05-28 14:33:22 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2011-10-17 01:10:32 +00:00
|
|
|
SERVER1=parallel-server1
|
2011-05-28 14:33:22 +00:00
|
|
|
SERVER2=parallel-server2
|
2011-10-17 01:10:32 +00:00
|
|
|
SSHLOGIN1=parallel@$SERVER1
|
|
|
|
SSHLOGIN2=parallel@$SERVER2
|
2011-05-28 14:33:22 +00:00
|
|
|
|
2011-07-20 23:58:23 +00:00
|
|
|
# -L1 will join lines ending in ' '
|
2011-10-17 01:10:32 +00:00
|
|
|
cat <<'EOF' | sed -e s/\$SERVER1/$SERVER1/\;s/\$SERVER2/$SERVER2/\;s/\$SSHLOGIN1/$SSHLOGIN1/\;s/\$SSHLOGIN2/$SSHLOGIN2/ | parallel -j0 -k -L1
|
2011-07-20 23:58:23 +00:00
|
|
|
echo '### Test --onall';
|
2011-10-17 01:10:32 +00:00
|
|
|
parallel --onall -S $SSHLOGIN1,$SSHLOGIN2 '(echo {3} {2}) | awk \{print\ \$2}' ::: a b c ::: 1 2
|
2011-07-20 23:58:23 +00:00
|
|
|
|
|
|
|
echo '### Test | --onall';
|
2011-10-17 01:10:32 +00:00
|
|
|
seq 3 | parallel --onall -S $SSHLOGIN1,$SSHLOGIN2 '(echo {3} {2}) | awk \{print\ \$2}' ::: a b c :::: -
|
2011-07-20 23:58:23 +00:00
|
|
|
|
|
|
|
echo '### Test --onall -u';
|
2011-10-17 01:10:32 +00:00
|
|
|
parallel --onall -S $SSHLOGIN1,$SSHLOGIN2 -u '(echo {3} {2}) | awk \{print\ \$2}' ::: a b c ::: 1 2 3 | sort
|
2011-07-20 23:58:23 +00:00
|
|
|
|
|
|
|
echo '### Test --nonall';
|
2011-10-17 01:10:32 +00:00
|
|
|
parallel --nonall -k -S $SSHLOGIN1,$SSHLOGIN2 'hostname' | sort
|
2011-07-20 23:58:23 +00:00
|
|
|
|
|
|
|
echo '### Test --nonall -u';
|
2011-10-17 22:04:20 +00:00
|
|
|
parallel --nonall -S $SSHLOGIN1,$SSHLOGIN2 -u 'hostname|grep -q vh1 && sleep 2; hostname;sleep 4;hostname;'
|
2011-07-20 23:58:23 +00:00
|
|
|
|
|
|
|
echo '### Test read sshloginfile from STDIN';
|
2011-10-17 01:10:32 +00:00
|
|
|
echo $SSHLOGIN1 | parallel -S - --nonall hostname;
|
|
|
|
echo $SSHLOGIN1 | parallel --sshloginfile - --nonall hostname
|
2011-08-20 19:13:25 +00:00
|
|
|
|
|
|
|
echo '### Test --nonall --basefile';
|
|
|
|
touch /tmp/nonall--basefile;
|
2011-10-17 01:10:32 +00:00
|
|
|
parallel --nonall --basefile /tmp/nonall--basefile -S $SSHLOGIN1,$SSHLOGIN2 ls /tmp/nonall--basefile
|
2011-08-20 19:13:25 +00:00
|
|
|
|
|
|
|
echo '### Test --onall --basefile';
|
|
|
|
touch /tmp/onall--basefile;
|
2011-10-17 01:10:32 +00:00
|
|
|
parallel --onall --basefile /tmp/onall--basefile -S $SSHLOGIN1,$SSHLOGIN2 ls ::: /tmp/onall--basefile
|
2011-06-03 12:53:14 +00:00
|
|
|
EOF
|