IpsecXWRT: status-strongswan.sh

File status-strongswan.sh, 1.5 kB (added by thomas, 4 months ago)

strongSwan status page

Line 
1 #!/usr/bin/webif-page
2 <?
3 . /usr/lib/webif/webif.sh
4
5 FORM_start_button=${FORM_start_button:-}
6 FORM_stop_button=${FORM_stop_button:-}
7
8 header "Status" "strongSwan status" "@TR<<strongSwan status>>" '' "$SCRIPT_NAME"
9
10 if [ -e /var/run/charon.pid ]; then
11     charon_pid=$(cat /var/run/charon.pid)
12     echo "strongSwan is running (PID: $charon_pid)"
13     echo "<br /><br />"
14     echo "Current connections:"
15         echo "<br /><span style="color:green">"
16     eval echo status > /var/run/charon.fifo
17     status=$(cat /var/run/charon.fifo)
18     echo $status
19     echo "<br /><br />"
20     echo "</span>"
21 else
22     echo "strongSwan is not running"
23     echo "<br /><br />"
24 fi
25
26 display_form <<EOF
27 start_form
28 submit|start_button|@TR<<start strongSwan>>
29 submit|stop_button|@TR<<stop strongSwan>>
30 end_form
31 cat <<EOF
32 EOF
33
34 ! empty $FORM_start_button || ! empty $FORM_stop_button && {
35
36     ! empty $FORM_start_button && {
37         command="/etc/init.d/strongswan start"
38         message="Charon has been started." 
39         style="style="color:green""
40     }
41
42     ! empty $FORM_stop_button && {
43         command="/etc/init.d/strongswan stop"
44         message="Charon has been terminated."
45         style="style="color:red""
46     }
47    
48     $command > /dev/null
49     echo "<br /><br /><span $style>$message</span><br /><br />"
50                            
51 }
52
53 echo "<a href="status-strongswan.sh">refresh</a>"
54 echo "<br /><br />"
55 echo "<a href="vpn-strongswan.sh">Go to strongSwan configuration</a>"
56                                                                                        
57
58  footer ?>
59 <!--
60 ##WEBIF:name:Status:990:strongSwan
61 -->