Fix: Remove sudo usage in launcher.php to avoid password prompt; enable logging
This commit is contained in:
@@ -1755,12 +1755,13 @@ if ($type == "set_cpu_power_mode") {
|
|||||||
if ($type == "screen_control") {
|
if ($type == "screen_control") {
|
||||||
$action = $_GET['action'];
|
$action = $_GET['action'];
|
||||||
if ($action == "start") {
|
if ($action == "start") {
|
||||||
// Run as background process
|
// Run as background process without sudo (requires www-data in video group)
|
||||||
$command = 'nohup sudo /usr/bin/python3 /var/www/nebuleair_pro_4g/screen_control/screen.py > /dev/null 2>&1 &';
|
// Redirecting to a temp log file to debug startup issues
|
||||||
|
$command = 'export DISPLAY=:0 && nohup /usr/bin/python3 /var/www/nebuleair_pro_4g/screen_control/screen.py > /tmp/screen_control.log 2>&1 &';
|
||||||
shell_exec($command);
|
shell_exec($command);
|
||||||
echo "Started";
|
echo "Started. Check /tmp/screen_control.log for details.";
|
||||||
} elseif ($action == "stop") {
|
} elseif ($action == "stop") {
|
||||||
$command = 'sudo pkill -f "screen.py" 2>&1';
|
$command = 'pkill -f "screen.py" 2>&1';
|
||||||
$output = shell_exec($command);
|
$output = shell_exec($command);
|
||||||
echo "Stopped. Output: " . $output;
|
echo "Stopped. Output: " . $output;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user