mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-07-06 04:51:52 -07:00
Added system reboot endpoint.
This commit is contained in:
parent
85fb81f6d2
commit
85ee500306
1 changed files with 23 additions and 0 deletions
23
web/api/v1/restart/system/index.php
Normal file
23
web/api/v1/restart/system/index.php
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
// Init
|
||||||
|
error_reporting(NULL);
|
||||||
|
ob_start();
|
||||||
|
session_start();
|
||||||
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
|
// Check token
|
||||||
|
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_SESSION['user'] == 'admin') {
|
||||||
|
if (!empty($_GET['hostname'])) {
|
||||||
|
exec (VESTA_CMD."v-restart-system yes", $output, $return_var);
|
||||||
|
$_SESSION['error_msg'] = 'The system is going down for reboot NOW!';
|
||||||
|
}
|
||||||
|
unset($output);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode(array('error' => $_SESSION['error_msg']));
|
||||||
|
|
||||||
|
unset($_SESSION['error_msg']);
|
Loading…
Add table
Add a link
Reference in a new issue