diff options
author | Yves-Alexis Perez <corsac@debian.org> | 2013-02-07 13:27:27 +0100 |
---|---|---|
committer | Yves-Alexis Perez <corsac@debian.org> | 2013-02-07 13:27:27 +0100 |
commit | 7585facf05d927eb6df3929ce09ed5e60d905437 (patch) | |
tree | e4d14b4dc180db20356b6b01ce0112f3a2d7897e /testing/hosts/default/usr/local | |
parent | c1343b3278cdf99533b7902744d15969f9d6fdc1 (diff) | |
download | vyos-strongswan-7585facf05d927eb6df3929ce09ed5e60d905437.tar.gz vyos-strongswan-7585facf05d927eb6df3929ce09ed5e60d905437.zip |
Imported Upstream version 5.0.2
Diffstat (limited to 'testing/hosts/default/usr/local')
-rwxr-xr-x | testing/hosts/default/usr/local/bin/expect-connection | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/testing/hosts/default/usr/local/bin/expect-connection b/testing/hosts/default/usr/local/bin/expect-connection new file mode 100755 index 000000000..10a709255 --- /dev/null +++ b/testing/hosts/default/usr/local/bin/expect-connection @@ -0,0 +1,27 @@ +#!/bin/bash +# +# Wait until a given IPsec connection becomes available +# +# Params: +# $1 - connection name +# $2 - maximum time to wait in seconds, default is 5 seconds + +if [[ $# -lt 1 || $# -gt 2 ]] +then + echo "invalid arguments" + exit 1 +fi + +secs=$2 +[ ! $secs ] && secs=5 + +let steps=$secs*10 +for i in `seq 1 $steps` +do + ipsec statusall 2>&1 | grep ^[[:space:]]*$1: >/dev/null + [ $? -eq 0 ] && exit 0 + sleep 0.1 +done + +echo "Connection '$1' not available after $secs second(s)" +exit 1 |