freebsd-src/etc/rc.d
Ralf S. Engelschall 62bb1d78fe Improve the RC framework for the clean booting/shutdown of Jails:
1. Feature: for flexibility reasons and as a prerequisite to clean
   shutdowns, allow the configuration of a stop/shutdown command
   via rc.conf variable "jail_<name>_exec_stop" in addition to the
   start/boot command (rc.conf variable "jail_<name>_exec_start"). For
   backward compatibility reasons, rc.conf variable "jail_<name>_exec"
   is still supported, too.

2. Debug: Add the used boot/shutdown commands to the debug output of
   the /etc/rc.d/jail script, too.

3. Security: Run the Jail start/boot command in a cleaned environment
   to not leak information from the host to the Jail during startup.

4. Feature: Run the Jail stop/shutdown command "jail_<name>_exec_stop" on
   "/etc/rc.d/jail stop <name>" to allow a graceful shutdown of the Jail
   before its processes are just killed.

5. Bugfix: When killing the remaining Jail processes give the processes
   time to actually perform their termination sequence. Without this the
   subsequent umount(8) operations usually fail because the resources
   are still in use. Additionally, if after trying to TERM-inate the
   processes there are still processes hanging around, finally just KILL
   them.

6. Bugfix: In rc.shutdown, if running inside a Jail, skip the /etc/rc.d/*
   scripts which are flagged with the KEYWORD "nojail" to allow the
   correct operation of rc.shutdown under jail_<name>_exec_stop="/bin/sh
   /etc/rc.shutdown". This is analogous to what /etc/rc does inside a Jail.

Now the following typical host-configuration for two Jails works as
expected and correctly boots and shutdowns the Jails:

-----------------------------------------------------------
#  /etc/rc.conf:
jail_enable="YES"
jail_list="foo bar"
jail_foo_rootdir="/j/foo"
jail_foo_hostname="foo.example.com"
jail_foo_ip="192.168.0.1"
jail_foo_devfs_enable="YES"
jail_foo_mount_enable="YES"
jail_foo_exec_start="/bin/sh /etc/rc"
jail_foo_exec_stop="/bin/sh /etc/rc.shutdown"
jail_bar_rootdir="/j/bar"
jail_bar_hostname="bar.example.com"
jail_bar_ip="192.168.0.2"
jail_bar_devfs_enable="YES"
jail_bar_mount_enable="YES"
jail_bar_exec_start="/path/to/kjailer -v"
jail_bar_exec_stop="/bin/sh -c 'killall kjailer && sleep 60'"
-----------------------------------------------------------
#  /etc/fstab.foo
/v/foo /j/foo/v/foo nullfs rw 0 0
-----------------------------------------------------------
#  /etc/fstab.bar
/v/bar /j/bar/v/bar nullfs rw 0 0
-----------------------------------------------------------

Reviewed by:	freebsd-hackers
MFC after:	2 weeks
2004-12-14 14:36:35 +00:00
..
abi Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
accounting Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
addswap Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
adjkerntz Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
altqd Sync with NetBSD's mainline. 2002-06-21 19:07:21 +00:00
amd Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
apm Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
apmd Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
archdep Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
atm1 Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
atm2 Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
atm3 Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
bgfsck Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
bootconf.sh Fix style bugs: 2002-10-12 10:31:31 +00:00
bootparams Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
ccd Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
cleanvar Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
cleartmp Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
cron Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
DAEMON Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
devd Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
devfs Move devfs earlier in the boot sequence. Some system daemons and other 2004-10-23 06:50:50 +00:00
dhclient Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
dhcpd Sync with NetBSD's mainline. 2002-06-21 19:07:21 +00:00
dhcrelay Sync with NetBSD's mainline. 2002-06-21 19:07:21 +00:00
dmesg Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
downinterfaces Sync with NetBSD's mainline. 2002-06-21 19:07:21 +00:00
dumpon When dumpdev is set to 'auto', and a suitable swap device is found, 2004-10-18 23:40:13 +00:00
early.sh Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
encswap Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
fsck Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
gated
gbde Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
gbde_swap Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
hostname Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
ifwatchd Sync with NetBSD's mainline. 2002-06-21 19:07:21 +00:00
ike Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
inetd Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
initdiskless Use utils from /rescue vs. /stand. Also use pax rather than cpio & gzip. 2004-12-12 08:04:26 +00:00
initrandom Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
ip6addrctl Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
ip6fw Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
ipfilter Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
ipfs Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
ipfw Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
ipmon Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
ipnat Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
ipsec Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
ipxrouted Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
isdnd Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
jail Improve the RC framework for the clean booting/shutdown of Jails: 2004-12-14 14:36:35 +00:00
kadmind Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
kdc Sync with NetBSD's mainline. 2002-06-21 19:07:21 +00:00
kerberos Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
keyserv Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
kldxref Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
kpasswdd Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
ldconfig Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
lkm1 Merge in all the changes that Mike Makonnen has been maintaining for a 2002-06-13 22:14:37 +00:00
lkm2 Merge in all the changes that Mike Makonnen has been maintaining for a 2002-06-13 22:14:37 +00:00
lkm3 Sync with NetBSD's mainline. 2002-06-21 19:07:21 +00:00
local Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
localpkg Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
lockd Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
LOGIN Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
lomac Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
lpd Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
Makefile Convince mergemaster to maintain/merge ramdisk scripts too. 2004-11-16 04:20:09 +00:00
mixer Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
mixerctl Sync with NetBSD's mainline. 2002-06-21 19:07:21 +00:00
mopd Sync with NetBSD's mainline. 2002-06-21 19:07:21 +00:00
motd Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
mountall Merge in all the changes that Mike Makonnen has been maintaining for a 2002-06-13 22:14:37 +00:00
mountcritlocal Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
mountcritremote Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
mountd Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
moused Do a better job of supporting more than one mouse device 2004-11-01 18:05:41 +00:00
mroute6d Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
mrouted Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
msgs Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
named Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
natd Automatically load the ipdivert module if it was not compiled into the kernel 2004-10-22 19:36:03 +00:00
ndbootd Sync with NetBSD's mainline. 2002-06-21 19:07:21 +00:00
netif Allow to change interfaces name on boot time. 2004-10-30 13:44:06 +00:00
netoptions Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
network - Use "/bin/hostname" explicitly instead of "hostname". 2004-04-02 12:18:40 +00:00
network_ipv6 Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
NETWORKING Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
newsyslog Sync with NetBSD's mainline. 2002-06-21 19:07:21 +00:00
nfsclient Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
nfsd Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
nfslocking Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
nfsserver Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
nisdomain Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
nsswitch Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
ntpd Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
ntpdate Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
othermta Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
pccard Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
pcvt Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
pf - Add 'check' command for checking rules syntax. 2004-10-25 08:12:28 +00:00
pflog Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
poffd Merge in all the changes that Mike Makonnen has been maintaining for a 2002-06-13 22:14:37 +00:00
postfix Sync with NetBSD's mainline. 2002-06-21 19:07:21 +00:00
power_profile Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
ppp Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
ppp-user Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
pppoed Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
preseedrandom Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
pwcheck Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
quota Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
racoon Sync with NetBSD's mainline. 2002-06-21 19:07:21 +00:00
raidframe Sync with NetBSD's mainline. 2002-06-21 19:07:21 +00:00
ramdisk Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
ramdisk-own Shutup debugging output. 2004-11-16 04:14:28 +00:00
random Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
rarpd Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
rbootd Sync with NetBSD's mainline. 2002-06-21 19:07:21 +00:00
rcconf.sh Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
resolv Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
root Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
route6d Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
routed Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
routing Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
rpcbind Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
rtadvd Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
rtsold Sync with NetBSD's mainline. 2002-06-21 19:07:21 +00:00
rwho Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
savecore - use realpath /dev/dumpdev instead of just /dev/dumpdev so messages 2004-10-24 13:04:09 +00:00
screenblank Sync with NetBSD's mainline. 2002-06-21 19:07:21 +00:00
securelevel Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
sendmail Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
serial Unify the ci/co variables now that the the tty drivers now use the same 2004-11-14 19:51:34 +00:00
SERVERS Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
sppp Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
sshd Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
statd Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
swap1 Stop method for swap1 script was introduced, because gmirror needed it. 2004-11-05 12:38:27 +00:00
swap2 Sync with NetBSD's mainline. 2002-06-21 19:07:21 +00:00
syscons Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
sysctl Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
sysdb Sync with NetBSD's mainline. 2002-06-21 19:07:21 +00:00
syslogd Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
timed Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
tmp Add two new rc.conf options: tmpmfs_flags and varmfs_flags. 2004-11-09 10:03:17 +00:00
ugidfw Remove requirement on FreeBSD keyword. 2004-10-14 04:37:57 +00:00
usbd Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
var Add two new rc.conf options: tmpmfs_flags and varmfs_flags. 2004-11-09 10:03:17 +00:00
virecover Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
watchdogd Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
wscons Fix style bugs: 2002-10-12 10:31:31 +00:00
xdm
xfs Sync with NetBSD's mainline. 2002-06-21 19:07:21 +00:00
ypbind Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
yppasswdd Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
ypserv Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
ypset Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
ypupdated Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00
ypxfrd Remove the requirement for the FreeBSD keyword as it no longer 2004-10-07 13:55:26 +00:00