File: wait-until-pluto-started

package info (click to toggle)
libreswan 4.3-1%2Bdeb11u4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 62,688 kB
  • sloc: ansic: 108,293; sh: 25,973; xml: 11,756; python: 10,230; makefile: 1,580; javascript: 1,353; yacc: 825; sed: 647; perl: 584; lex: 159; awk: 156
file content (32 lines) | stat: -rwxr-xr-x 731 bytes parent folder | download
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
28
29
30
31
32
#!/bin/sh

# Wait until both whack can talk to pluto and the addconn process has
# disappeared.  This will delay until pluto is started

echo ==== cut ====
count=10
while count=$(expr $count - 1) && test $count -gt 0 ; do
    # both need to attach ...
    if ps=$(ipsec whack --processstatus) ; then
	echo "${ps}"
	# ... and not find addconn
	if echo "${ps}" | grep addconn ; then
	    echo try again
	else
	    echo addconn exited
	    break
	fi
    fi
    sleep 1
done
echo ==== tuc ====

# what took so long?
if [ $count -eq 0 ]
then
   if echo $SUDO_COMMAND | grep "/bin/nsenter " > /dev/null 2>&1 ; then
	echo "pluto in namespace failed to start - check logs or output"
   else
	systemctl --full status ipsec.service
   fi
fi