Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
d1f97f7b
Commit
d1f97f7b
authored
Mar 10, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rc: simplify halt/reboot a bit and use synchronous halt on the console
parent
f5b013a0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
16 deletions
+19
-16
system.inc
src/etc/inc/system.inc
+16
-13
rc.initial.defaults
src/etc/rc.initial.defaults
+1
-1
rc.initial.halt
src/etc/rc.initial.halt
+1
-1
rc.initial.reboot
src/etc/rc.initial.reboot
+1
-1
No files found.
src/etc/inc/system.inc
View file @
d1f97f7b
...
...
@@ -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 &"
);
}
function
system_reboot
()
{
global
$g
;
$cmd
=
'/usr/local/etc/rc.halt > /dev/null 2>&1'
;
system_reboot_cleanup
();
if
(
!
$sync
)
{
$cmd
=
sprintf
(
'/usr/bin/nohup %s &'
,
$cmd
);
}
mwexec
(
"nohup /usr/local/etc/rc.reboot > /dev/null 2>&1 &"
);
mwexec
(
$cmd
);
}
function
system_reboot_sync
()
{
global
$g
;
function
system_reboot
(
$sync
=
false
)
{
system_reboot_cleanup
();
mwexec
(
"/usr/local/etc/rc.reboot > /dev/null 2>&1"
);
$cmd
=
'/usr/local/etc/rc.reboot > /dev/null 2>&1'
;
if
(
!
$sync
)
{
$cmd
=
sprintf
(
'/usr/bin/nohup %s &'
,
$cmd
);
}
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
);
}
...
...
src/etc/rc.initial.defaults
View file @
d1f97f7b
...
...
@@ -52,7 +52,7 @@ if (strcasecmp(chop(fgets($fp)), "y") == 0) {
EOD;
system_reboot
_sync
(
);
system_reboot
(
true
);
}
fclose
(
$fp
);
src/etc/rc.initial.halt
View file @
d1f97f7b
...
...
@@ -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
);
src/etc/rc.initial.reboot
View file @
d1f97f7b
...
...
@@ -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
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment