This commit is contained in:
PaulVua
2025-01-30 13:46:22 +01:00
parent a689a7d2de
commit 4f59928b1e
5 changed files with 248 additions and 19 deletions

View File

@@ -42,6 +42,33 @@ if ($type == "git_pull") {
echo $output;
}
if ($type == "set_RTC_withNTP") {
$command = '/usr/bin/python3 /var/www/nebuleair_pro_4g/RTC/set_with_NTP.py';
$output = shell_exec($command);
echo $output;
}
if ($type == "set_RTC_withBrowser") {
$time = $_GET['time'];
// Validate time format
if (!strtotime($time)) {
echo json_encode(['success' => false, 'message' => 'Invalid time format']);
exit;
}
// Convert to RTC-compatible format (e.g., 'YYYY-MM-DD HH:MM:SS')
$rtc_time = date('Y-m-d H:i:s', strtotime($time));
// Execute Python script to update the RTC
$command = escapeshellcmd("/usr/bin/python3 /var/www/nebuleair_pro_4g/RTC/set_with_browserTime.py '$rtc_time'");
$output = shell_exec($command);
if ($output === null) {
echo json_encode(['success' => false, 'message' => 'Failed to update RTC']);
} else {
echo json_encode(['success' => true, 'message' => 'RTC updated successfully']);
}
}
if ($type == "clear_loopLogs") {
$command = 'truncate -s 0 /var/www/nebuleair_pro_4g/logs/loop.log';
$output = shell_exec($command);