mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 17:14:46 +00:00
rc: simplify halt/reboot a bit and use synchronous halt on the console
This commit is contained in:
parent
f5b013a0dc
commit
d1f97f7b26
@ -1662,27 +1662,30 @@ function sync_system_time() {
|
||||
|
||||
}
|
||||
|
||||
function system_halt()
|
||||
function system_halt($sync = false)
|
||||
{
|
||||
system_reboot_cleanup();
|
||||
|
||||
mwexec("/usr/bin/nohup /usr/local/etc/rc.halt > /dev/null 2>&1 &");
|
||||
$cmd ='/usr/local/etc/rc.halt > /dev/null 2>&1';
|
||||
|
||||
if (!$sync) {
|
||||
$cmd = sprintf('/usr/bin/nohup %s &', $cmd);
|
||||
}
|
||||
|
||||
mwexec($cmd);
|
||||
}
|
||||
|
||||
function system_reboot() {
|
||||
global $g;
|
||||
|
||||
function system_reboot($sync = false)
|
||||
{
|
||||
system_reboot_cleanup();
|
||||
|
||||
mwexec("nohup /usr/local/etc/rc.reboot > /dev/null 2>&1 &");
|
||||
}
|
||||
$cmd ='/usr/local/etc/rc.reboot > /dev/null 2>&1';
|
||||
|
||||
function system_reboot_sync() {
|
||||
global $g;
|
||||
if (!$sync) {
|
||||
$cmd = sprintf('/usr/bin/nohup %s &', $cmd);
|
||||
}
|
||||
|
||||
system_reboot_cleanup();
|
||||
|
||||
mwexec("/usr/local/etc/rc.reboot > /dev/null 2>&1");
|
||||
mwexec($cmd);
|
||||
}
|
||||
|
||||
function system_reboot_cleanup() {
|
||||
@ -1841,7 +1844,7 @@ function system_check_reset_button() {
|
||||
EOD;
|
||||
|
||||
reset_factory_defaults();
|
||||
system_reboot_sync();
|
||||
system_reboot(true);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ if (strcasecmp(chop(fgets($fp)), "y") == 0) {
|
||||
|
||||
EOD;
|
||||
|
||||
system_reboot_sync();
|
||||
system_reboot(true);
|
||||
}
|
||||
|
||||
fclose($fp);
|
||||
|
||||
@ -39,7 +39,7 @@ echo "\nDo you want to proceed [y|n]? ";
|
||||
|
||||
if (strcasecmp(chop(fgets($fp)), 'y') == 0) {
|
||||
echo "\n{$g['product_name']} will shutdown and halt system now.\n";
|
||||
system_halt();
|
||||
system_halt(true);
|
||||
}
|
||||
|
||||
fclose($fp);
|
||||
|
||||
@ -40,7 +40,7 @@ echo "\nDo you want to proceed [y|n]? ";
|
||||
|
||||
if (strcasecmp(chop(fgets($fp)), 'y') == 0) {
|
||||
echo "\n{$g['product_name']} is rebooting now.\n\n";
|
||||
system_reboot_sync();
|
||||
system_reboot(true);
|
||||
}
|
||||
|
||||
fclose($fp);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user