Small tweak to the default behavior of shutdown -c

'shutdown -c' is supposed to power cycle the system rather than doing a normal
reboot. However, when that fails, it halts the system. This is not quite right
since the intent isn't to halt the system but to restart. Make the default init
behavior be to restart the system. The halt(8) interface can be used if you'd
like to powercycle or halt.

MFC After: 1 week
Differential Revision: https://reviews.freebsd.org/D23129
This commit is contained in:
Warner Losh 2020-01-17 01:20:48 +00:00
parent 38b37b93d4
commit 73c6e0c358
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=356821
2 changed files with 6 additions and 4 deletions

View File

@ -1629,12 +1629,14 @@ transition_handler(int sig)
current_state == clean_ttys || current_state == catatonia)
requested_transition = clean_ttys;
break;
case SIGWINCH:
case SIGUSR2:
howto = sig == SIGUSR2 ? RB_POWEROFF : RB_POWERCYCLE;
howto = RB_POWEROFF;
case SIGUSR1:
howto |= RB_HALT;
case SIGWINCH:
case SIGINT:
if (sig == SIGWINCH)
howto |= RB_POWERCYCLE;
Reboot = TRUE;
case SIGTERM:
if (current_state == read_ttys || current_state == multi_user ||

View File

@ -28,7 +28,7 @@
.\" @(#)shutdown.8 8.2 (Berkeley) 4/27/95
.\" $FreeBSD$
.\"
.Dd January 1, 2018
.Dd January 11, 2020
.Dt SHUTDOWN 8
.Os
.Sh NAME
@ -63,7 +63,7 @@ The following options are available:
The system is power cycled (power turned off and then back on)
at the specified time.
If the hardware doesn't support power cycle, the system will be
halted.
rebooted.
At the present time, only systems with BMC supported by the
.Xr ipmi 4
driver that implement this functionality support this flag.