Author: Jan Wagner <waja@cyconet.org>
Description:
 Patches check_ipsec to fix syntax issues

diff --git a/check_ipsec/check_ipsec b/check_ipsec/check_ipsec
index 29834df..084e6ee 100644
--- a/check_ipsec/check_ipsec
+++ b/check_ipsec/check_ipsec
@@ -96,7 +96,7 @@ print_help() {
 
 check_tunnel() {
 
-	if [[ "$STRONG" -eq "1" ]]
+	if [ "$STRONG" -eq "1" ]
 	then
 	    eroutes=`$IPSECBIN status | grep -e "IPsec SA established" | grep -e "newest IPSEC" | wc -l`
 	else
@@ -104,21 +104,21 @@ check_tunnel() {
 	fi 
 
 	
-	if [[ "$eroutes" -eq "$2" ]]
+	if [ "$eroutes" -eq "$2" ]
 	then
 		echo "OK - All $2 tunnels are up an running"
 		exit $STATE_OK
-	elif [[ "$eroutes" -gt "$2" ]]
+	elif [ "$eroutes" -gt "$2" ]
 	then
 		echo "WARNING - More than $2 ($eroutes) tunnels are up an running"
                 exit $STATE_WARNING
 	else
 		echo "CRITICAL - Only $eroutes tunnels from $2 are up an running - $(location)"
+		location
 		exit $STATE_CRITICAL
 	fi
 }
 
-
 location() {
 
 count=0
@@ -129,24 +129,24 @@ while read line; do
 	CONN=`echo $line| awk '{print $1}'`
 	IP=`echo $line| awk '{print $2}'`
 
-	if [[ "$STRONG" -eq "1" ]]
+	if [ "$STRONG" -eq "1" ]
 	then
 	    tunneltest=`$IPSECBIN status | grep -e "IPsec SA established" | grep -e "newest IPSEC" |grep -e $CONN | wc -l`
 	else
 	    tunneltest=`$IPSECBIN whack --status | grep -e "IPsec SA established" | grep -e "newest IPSEC" |grep -e "$CONN" | wc -l`
 	fi
 	
-	if [[ "$tunneltest" -eq "0" ]]
+	if [ "$tunneltest" -eq "0" ]
     then
         count=$[$count+1]
         DOWN="$DOWN $CONN"
     fi
 
-    if [[ "$PINGIP" -eq "1" && "$tunneltest" -eq "1" ]]
+    if [ "$PINGIP" -eq "1" && "$tunneltest" -eq "1" ]
     then
         alive=`$FPINGBIN $IP -r 1 | grep alive | wc -l`
 
-        if [[ "$alive" -eq "0" ]]
+        if [ "$alive" -eq "0" ]
         then
             count=$[$count+1]
             DOWN="$DOWN $CONN (no ping)"
