[strongSwan] Knowing when StrongSwan is up and ready

Ken Nelson ken at cazena.com
Fri Oct 2 17:39:01 CEST 2015

I have a bash script that does the following to start strongswan and initiate / establish a connection:

sudo service strongswan start
sleep 2
sudo strongswan up myconn

where myconn is defined in /etc/strongswan/ipsec.conf

Typically, the (arbitrary) two second delay is sufficient for SS to come up and be ready, however on some virtual machine environments it is not, producing the error:

no config named ‘myconn’

This is likely due to host load and/or filesystem delays.  

There are a number ways around this problem (lengthen delay, retry ‘up’ command, etc.), but I’m wondering if there is a deterministic, recommended way to know (from a Bash script) when StrongSwan is up and ready?  I didn’t see anything immediately obvious when looking at “strongswan —help” or “swanctl —help”.

More information about the Users mailing list