1
0
mirror of https://github.com/billz/raspap-webgui.git synced 2023-10-10 13:37:24 +02:00

Update stop/start, status

This commit is contained in:
billz 2020-04-22 10:01:31 +01:00
parent 8d73fb774f
commit 7c7b8941cb

View File

@ -19,28 +19,28 @@ function DisplayWireGuardConfig()
} }
} elseif (isset($_POST['startwg'])) { } elseif (isset($_POST['startwg'])) {
$status->addMessage('Attempting to start WireGuard', 'info'); $status->addMessage('Attempting to start WireGuard', 'info');
exec('sudo /bin/systemctl start wg-quick@wg0', $return); exec('sudo /usr/bin/wg-quick up wg0', $return);
exec('sudo /bin/systemctl enable wg-quick@wg0', $return);
foreach ($return as $line) { foreach ($return as $line) {
$status->addMessage($line, 'info'); $status->addMessage($line, 'info');
} }
} elseif (isset($_POST['stopwg'])) { } elseif (isset($_POST['stopwg'])) {
$status->addMessage('Attempting to stop WireGuard', 'info'); $status->addMessage('Attempting to stop WireGuard', 'info');
exec('sudo /bin/systemctl stop wg-quick@wg0', $return); exec('sudo /usr/bin/wg-quick down wg0', $return);
exec('sudo /bin/systemctl disable wg-quick@wg0', $return);
foreach ($return as $line) { foreach ($return as $line) {
$status->addMessage($line, 'info'); $status->addMessage($line, 'info');
} }
} }
} }
exec('pidof wg | wc -l', $wgstatus); exec('pidof wg-crypt-wg0 | wc -l', $wgstatus);
$serviceStatus = $wgstatus[0] == 0 ? "down" : "up"; $serviceStatus = $wgstatus[0] == 0 ? "down" : "up";
$wg_state = ($wgstatus[0] > 0);
echo renderTemplate( echo renderTemplate(
"wireguard", compact( "wireguard", compact(
"status", "status",
"wg_state",
"serviceStatus" "serviceStatus"
) )
); );