rc.d: Add precious_machine rc.conf knob to create /var/run/noshutdown
Reviewed by: bapt, kevans, olce Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D50166
This commit is contained in:
@@ -29,6 +29,8 @@
|
|||||||
rc_info="NO" # Enables display of informational messages at boot.
|
rc_info="NO" # Enables display of informational messages at boot.
|
||||||
rc_startmsgs="YES" # Show "Starting foo:" messages at boot
|
rc_startmsgs="YES" # Show "Starting foo:" messages at boot
|
||||||
rcshutdown_timeout="90" # Seconds to wait before terminating rc.shutdown
|
rcshutdown_timeout="90" # Seconds to wait before terminating rc.shutdown
|
||||||
|
precious_machine="NO" # Set to YES to get some guards against mis-directed
|
||||||
|
# shutdown(8) commands
|
||||||
early_late_divider="FILESYSTEMS" # Script that separates early/late
|
early_late_divider="FILESYSTEMS" # Script that separates early/late
|
||||||
# stages of the boot process. Make sure you know
|
# stages of the boot process. Make sure you know
|
||||||
# the ramifications if you change this.
|
# the ramifications if you change this.
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ CONFS= DAEMON \
|
|||||||
netif \
|
netif \
|
||||||
netoptions \
|
netoptions \
|
||||||
netwait \
|
netwait \
|
||||||
|
noshutdown \
|
||||||
${_nscd} \
|
${_nscd} \
|
||||||
${_opensm} \
|
${_opensm} \
|
||||||
os-release \
|
os-release \
|
||||||
|
|||||||
Executable
+31
@@ -0,0 +1,31 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
# PROVIDE: noshutdown
|
||||||
|
# REQUIRE: var
|
||||||
|
# BEFORE: LOGIN
|
||||||
|
|
||||||
|
. /etc/rc.subr
|
||||||
|
|
||||||
|
name="noshutdown"
|
||||||
|
desc="Disable shutdown(8) for precious machines"
|
||||||
|
rcvar="precious_machine"
|
||||||
|
start_cmd="noshutdown_start"
|
||||||
|
stop_cmd="noshutdown_stop"
|
||||||
|
|
||||||
|
: ${noshutdown_file:="/var/run/noshutdown"}
|
||||||
|
|
||||||
|
noshutdown_start()
|
||||||
|
{
|
||||||
|
touch $noshutdown_file
|
||||||
|
}
|
||||||
|
|
||||||
|
noshutdown_stop()
|
||||||
|
{
|
||||||
|
rm -f $noshutdown_file
|
||||||
|
}
|
||||||
|
|
||||||
|
load_rc_config $name
|
||||||
|
|
||||||
|
run_rc_command "$1"
|
||||||
Reference in New Issue
Block a user