2013-04-08 19:17:59 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2015-03-03 23:12:00 +00:00
|
|
|
# Check servers up on http://www.polarhome.com/service/status/
|
|
|
|
|
2017-07-21 21:29:19 +00:00
|
|
|
P_ALL="alpha tru64 hpux-ia64 syllable pidora raspbian solaris openindiana aix hpux qnx debian-ppc suse solaris-x86 mandriva ubuntu scosysv unixware centos miros macosx redhat netbsd openbsd freebsd debian dragonfly vax ultrix minix irix hurd beaglebone cubieboard2"
|
2013-07-19 17:13:00 +00:00
|
|
|
P_NOTWORKING="vax alpha openstep"
|
2014-01-22 01:54:18 +00:00
|
|
|
P_NOTWORKING_YET="ultrix irix"
|
2013-07-19 17:13:00 +00:00
|
|
|
|
2017-12-04 21:44:34 +00:00
|
|
|
P_WORKING="openbsd tru64 debian freebsd redhat netbsd macosx miros centos unixware pidora ubuntu scosysv raspbian solaris-x86 aix mandriva debian-ppc suse solaris hpux openindiana hpux-ia64"
|
2017-11-22 22:29:03 +00:00
|
|
|
P_WORKING="openbsd tru64 debian freebsd redhat netbsd macosx miros centos unixware pidora ubuntu scosysv raspbian solaris-x86 aix mandriva debian-ppc suse solaris hpux openindiana hpux-ia64"
|
|
|
|
P_TEMPORARILY_BROKEN="minix hurd dragonfly"
|
2013-07-19 17:13:00 +00:00
|
|
|
|
|
|
|
P="$P_WORKING"
|
|
|
|
POLAR=`parallel -k echo {}.polarhome.com ::: $P`
|
2015-08-22 06:59:21 +00:00
|
|
|
S_POLAR=`parallel -k echo -S 1/{}.polarhome.com ::: $P`
|
2015-12-19 01:46:32 +00:00
|
|
|
|
|
|
|
# 20150414 --timeout 80 -> 40
|
|
|
|
# 20151219 --retries 5 -> 2
|
2016-08-21 13:37:59 +00:00
|
|
|
# 20160821 --timeout 10 -> 100 (DNS problems)
|
2017-11-22 22:29:03 +00:00
|
|
|
# 20171122 --timeout 100 -> 20 (Raising it did not get more successes)
|
|
|
|
TIMEOUT=20
|
2016-05-22 12:08:47 +00:00
|
|
|
RETRIES=4
|
2013-04-08 19:17:59 +00:00
|
|
|
|
|
|
|
echo '### Tests on polarhome machines'
|
2017-12-04 21:44:34 +00:00
|
|
|
# On each remote machine:
|
|
|
|
# $HOME/setupenv is a sourcable script that sets path+activates env_parallel
|
|
|
|
# It is platform dependant
|
|
|
|
|
2013-04-11 19:55:33 +00:00
|
|
|
echo 'Setup on polarhome machines'
|
2015-12-19 01:46:32 +00:00
|
|
|
# Avoid the stupid /etc/issue.net banner at Polarhome: -oLogLevel=quiet
|
2017-12-04 21:44:34 +00:00
|
|
|
stdout parallel -kj0 --delay 0.2 ssh -oLogLevel=quiet {} mkdir -p bin ::: $POLAR &
|
|
|
|
|
|
|
|
par_onall() {
|
|
|
|
stdout parallel -j0 -k --retries $RETRIES --timeout $TIMEOUT --delay 0.1 --tag \
|
|
|
|
--onall $S_POLAR "$@"
|
|
|
|
}
|
|
|
|
export -f par_onall
|
2013-12-19 01:19:19 +00:00
|
|
|
|
2015-03-28 13:24:15 +00:00
|
|
|
test_empty_cmd() {
|
2016-04-05 22:57:07 +00:00
|
|
|
echo
|
2015-03-28 13:24:15 +00:00
|
|
|
echo '### Test if empty command in process list causes problems'
|
2016-04-05 22:57:07 +00:00
|
|
|
echo
|
2015-03-28 13:24:15 +00:00
|
|
|
perl -e '$0=" ";sleep 1' &
|
|
|
|
bin/perl bin/parallel echo ::: OK_with_empty_cmd
|
|
|
|
}
|
|
|
|
export -f test_empty_cmd
|
2017-07-21 21:29:19 +00:00
|
|
|
stdout parallel -j0 -k --retries $RETRIES --timeout $TIMEOUT --delay 0.03 --tag \
|
2015-03-28 13:24:15 +00:00
|
|
|
--nonall --env test_empty_cmd -S macosx.polarhome.com test_empty_cmd > /tmp/test_empty_cmd &
|
|
|
|
|
2017-07-21 21:29:19 +00:00
|
|
|
copy() {
|
|
|
|
host=$1
|
|
|
|
src="$2"
|
|
|
|
dst="$3"
|
|
|
|
cat "$src" |
|
|
|
|
stdout ssh -oLogLevel=quiet $host "cat > bin/'$dst'.tmp && chmod 755 bin/'$dst'.tmp && mv bin/'$dst'.tmp bin/'$dst'"
|
|
|
|
}
|
|
|
|
export -f copy
|
2017-12-04 21:44:34 +00:00
|
|
|
stdout parallel -kj30 -r --retries $RETRIES --timeout $TIMEOUT --delay 0.13 --tag -v \
|
2017-07-21 21:29:19 +00:00
|
|
|
copy {2} {1} {1/} \
|
|
|
|
::: /usr/local/bin/{parallel,env_parallel,env_parallel.*} \
|
|
|
|
::: $POLAR
|
|
|
|
|
2013-12-19 01:19:19 +00:00
|
|
|
copy_and_test() {
|
2013-07-19 17:13:00 +00:00
|
|
|
H=$1
|
2016-04-05 22:57:07 +00:00
|
|
|
# scp to each polarhome machine does not work. Use cat
|
2013-07-19 17:13:00 +00:00
|
|
|
# Avoid the stupid /etc/issue.net banner with -oLogLevel=quiet
|
2013-12-19 01:19:19 +00:00
|
|
|
echo '### Run the test on '$H
|
2016-04-05 22:57:07 +00:00
|
|
|
cat `which parallel` |
|
|
|
|
stdout ssh -oLogLevel=quiet $H 'cat > bin/p.tmp && chmod 755 bin/p.tmp && mv bin/p.tmp bin/parallel && bin/perl bin/parallel echo Works on {} ::: '$H &&
|
|
|
|
stdout ssh -oLogLevel=quiet $H 'bin/perl bin/parallel --tmpdir / echo ::: test read-only tmp' |
|
|
|
|
perl -pe '$exit += s:/[a-z0-9_]+.arg:/XXXXXXXX.arg:gi; $exit += s/\d\d\d\d/0000/gi; END { exit not $exit }' &&
|
|
|
|
echo OK
|
2013-07-19 17:13:00 +00:00
|
|
|
}
|
2013-12-19 01:19:19 +00:00
|
|
|
export -f copy_and_test
|
2016-04-05 22:57:07 +00:00
|
|
|
stdout parallel -j6 -k -r --retries $RETRIES --timeout $TIMEOUT --delay 0.1 --tag -v copy_and_test {} ::: $POLAR
|
2013-04-08 19:17:59 +00:00
|
|
|
|
2016-04-05 22:57:07 +00:00
|
|
|
echo
|
|
|
|
echo '### Test remote wrapper working on all platforms'
|
|
|
|
echo
|
2016-02-21 22:07:44 +00:00
|
|
|
parallel -j0 --nonall -k --timeout $TIMEOUT $S_POLAR hostname
|
2015-08-22 06:59:21 +00:00
|
|
|
|
2016-04-05 22:57:07 +00:00
|
|
|
echo
|
|
|
|
echo '### Does exporting a bash function kill parallel'
|
|
|
|
echo
|
|
|
|
# http://zmwangx.github.io/blog/2015-11-25-bash-function-exporting-fiasco.html
|
2017-12-04 21:44:34 +00:00
|
|
|
par_onall 'func() { cat <(echo bash only A); };export -f func; bin/parallel func ::: ' ::: 1
|
2016-04-05 22:57:07 +00:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo '### Does PARALLEL_SHELL help exporting a bash function not kill parallel'
|
|
|
|
echo
|
2017-12-04 21:44:34 +00:00
|
|
|
PARALLEL_SHELL=/bin/bash par_onall 'func() { cat <(echo bash only B); };export -f func; bin/parallel func ::: ' ::: 1
|
2016-04-05 22:57:07 +00:00
|
|
|
|
2017-07-06 15:22:50 +00:00
|
|
|
echo
|
|
|
|
echo '### env_parallel echo :::: <(echo OK)'
|
|
|
|
echo '(bash only)'
|
|
|
|
echo
|
2017-12-04 21:44:34 +00:00
|
|
|
par_onall 'bin/env_parallel --install && echo {}' ::: install-OK
|
|
|
|
par_onall 'source setupenv || . `pwd`/setupenv; env_parallel echo env_parallel :::' ::: run-OK
|
|
|
|
par_onall 'source setupenv || . `pwd`/setupenv; env_parallel echo reading from process substitution :::: <(echo {})' ::: OK |
|
|
|
|
# csh on NetBSD does not support process substitution
|
|
|
|
grep -v ': /tmp/.*: No such file or directory'
|
2017-07-06 15:22:50 +00:00
|
|
|
|
|
|
|
# eval 'myfunc() { echo '$(perl -e 'print "x"x20000')'; }'
|
|
|
|
# env_parallel myfunc ::: a | wc # OK
|
|
|
|
# eval 'myfunc2() { echo '$(perl -e 'print "x"x120000')'; }'
|
|
|
|
# env_parallel myfunc ::: a | wc # Fail too big env
|
|
|
|
# Can this be made faster using `ssh -M`?
|
|
|
|
# Can it be moved to virtualbox?
|
|
|
|
|
2016-04-05 22:57:07 +00:00
|
|
|
# Started earlier - therefore wait
|
|
|
|
wait; cat /tmp/test_empty_cmd
|
2015-03-28 13:24:15 +00:00
|
|
|
rm /tmp/test_empty_cmd
|