blob: 10a7092555fd0d49390fde3b3f7a173b494c4c4e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
|