wait_script foo hosts/bar-up
wait_script bar hosts/foo-up
- ip netns exec foo \
- socat -u TCP4-LISTEN:$recv_port_foo,reuseaddr OPEN:"$tmp_file",creat &
-
- ip netns exec bar \
- socat -u OPEN:"$ref_file" TCP4:$ip_foo:$recv_port_foo,retry=30 &
+ try_limit_time 60 sh <<EOF
+ set -eu
+ ip netns exec foo socat -u TCP4-LISTEN:$recv_port_foo,reuseaddr OPEN:"$tmp_file",creat &
+ ip netns exec bar socat -u OPEN:"$ref_file" TCP4:$ip_foo:$recv_port_foo,retry=30 &
+ wait
+EOF
- wait
diff -w "$ref_file" "$tmp_file"
tinc foo stop
# Runs its arguments with timeout(1) or gtimeout(1) if either are installed.
# Usage: try_limit_time 10 command --with --args
if type timeout >/dev/null; then
- if is_busybox; then
- # busybox does not support --foreground
- try_limit_time() {
- time=$1
- shift
- timeout "$time" "$@"
- }
- else
- # BSD and GNU timeout do not require special handling
- try_limit_time() {
- time=$1
- shift
- timeout --foreground "$time" "$@"
- }
- fi
+ try_limit_time() {
+ time=$1
+ shift
+ timeout "$time" "$@"
+ }
else
try_limit_time() {
echo >&2 "timeout was not found, running without time limits!"