diff options
author | Ermal <eri@pfsense.org> | 2010-09-06 13:10:08 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2010-09-06 13:10:08 +0000 |
commit | 45611d02b86a847f8c266390f2ebcb485893baad (patch) | |
tree | 83ae9dde52270d340a8595b897d9f778dbcae0aa | |
parent | c89609705be6271e6a302d7c1e08e736c247de43 (diff) | |
download | pfsense-45611d02b86a847f8c266390f2ebcb485893baad.zip pfsense-45611d02b86a847f8c266390f2ebcb485893baad.tar.gz |
Ticket #877. Some cleanup and fixes so that openvpn status works correctly.
-rwxr-xr-x | usr/local/www/status_services.php | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/usr/local/www/status_services.php b/usr/local/www/status_services.php index 584c8bc..3d4cfe0 100755 --- a/usr/local/www/status_services.php +++ b/usr/local/www/status_services.php @@ -91,12 +91,12 @@ if($_GET['mode'] == "restartservice" and !empty($_GET['service'])) { $vpnmode = $_GET['vpnmode']; if ($vpnmode == "server" || $vpnmode == "client") { $id = $_GET['id']; - if (is_numeric($id)) { - $pidfile = $g['varrun_path'] . "/openvpn_{$vpnmode}{$id}.pid"; + $configfile = "{$g['varetc_path']}/openvpn/{$vpnmode}{$id}.conf"; + $pidfile = $g['varrun_path'] . "/openvpn_{$vpnmode}{$id}.pid"; + if (file_exists($configfile)) { killbypid($pidfile); sleep(1); - $configfile = $g['varetc_path'] . "/openvpn_{$vpnmode}{$id}.conf"; - mwexec_bg("/usr/local/sbin/openvpn --config $configfile"); + mwexec_bg("/usr/local/sbin/openvpn --config {$configfile}"); } } break; @@ -139,10 +139,9 @@ if($_GET['mode'] == "startservice" and !empty($_GET['service'])) { $vpnmode = $_GET['vpnmode']; if (($vpnmode == "server") || ($vpnmode == "client")) { $id = $_GET['id']; - if (is_numeric($id)) { - $configfile = "{$g['varetc_path']}/openvpn/{$vpnmode}{$id}.conf"; + $configfile = "{$g['varetc_path']}/openvpn/{$vpnmode}{$id}.conf"; + if (file_exists($configfile)) mwexec_bg("/usr/local/sbin/openvpn --config {$configfile}"); - } } break; default: @@ -196,10 +195,8 @@ if($_GET['mode'] == "stopservice" && !empty($_GET['service'])) { $vpnmode = $_GET['vpnmode']; if (($vpnmode == "server") or ($vpnmode == "client")) { $id = $_GET['id']; - if (is_numeric($id)) { - $pidfile = "{$g['varrun_path']}/openvpn_{$vpnmode}{$id}.pid"; - killbypid($pidfile); - } + $pidfile = "{$g['varrun_path']}/openvpn_{$vpnmode}{$id}.pid"; + killbypid($pidfile); } break; default: |