Commit Graph

173 Commits

Author SHA1 Message Date
christos 476172bce3 set cloexec to the rc postprocessor fd (rudolf in tech-userlevel) 2017-03-20 16:02:48 +00:00
christos 7e6c542685 add + 2017-02-02 20:49:55 +00:00
christos 8fb3f05024 set 7 and 8 to close on exec. 2017-02-02 20:01:36 +00:00
apb 8a948b4343 In the background subshell that flushes partial output every few
seconds, detach from the controlling terminal.  Without this, pressing
control-T (to send SIGINFO from the terminal) would almost always result
in the sleep process printing "about N seconds left of the original 3",
which is useless information.
2014-07-29 20:39:16 +00:00
apb 7bc384757f In rc.subr, add _have_rc_postprocessor function and use it instead of
inline tests like [ -n "${_rc_postprocessor_fd}" ]. The new function
performs a few new tests, including verifying that /etc/rc is still
running (using a new _rc_pid variable set by /etc/rc).

This is intended to deal with the case that a script run from /etc/rc
spawns a background process, then /etc/rc exits, but the background
process still has environment variables inherited from /etc/rc.

Fixes PR 46546.
2014-07-27 07:46:46 +00:00
apb 288496e5c0 Send a "nop" metadata message to the postprocessor every few seconds,
to flush partial output lines.  This should help with PR 48714.
2014-04-09 12:45:05 +00:00
apb 11bfaf8d26 Add comments about the intended use of each type of metadata message. 2014-04-09 12:38:09 +00:00
apb 7535058544 Allow "echo -n" to work as expected in rc.d scripts that are executed
by /etc/rc.  Similarly for printf with a format that does not end with
"\n".  Previously, the partial line would not be visible on the console
until a newline was printed, possibly after an annoying delay.

This is done by adding echo() and printf() shell functions to rc.subr,
so that naive use of the echo and printf commands in rc.d scripts will
call these functions instead of the underlying commands.  These shell
functions send a new "nop" metadata message after the partial line, and
the rc_postprocess function in /etc/rc disentangles the partial line of
plain output from the metadata "nop".

Also add a "-n" option to the print_rc_normal function in rc.subr,
and make some cosmetic changes.
2011-08-11 22:52:46 +00:00
christos 520fd1e568 print human readable exit code. 2010-06-04 18:42:54 +00:00
apb 89fd535731 Add a postprocessor to /etc/rc, which logs messages to /var/run/rc.log,
and which can suppress output in silent mode.  Silent mode is enabled
via the new rc_silent variable, which defaults to a value that depends
on the kern.boothowto sysctl.

Part of the /etc/rc silent changes requested in PR 41946
and proposed in tech-userlevel.
2009-09-11 18:17:04 +00:00
joerg 760b4799c4 Add rc_directories to specify where to look for rc scripts.
For the moment all scripts must be in /root and non-existent directories
are skipped.
2009-04-10 16:18:04 +00:00
lukem 15388316f6 Change how internal boolean variables are used to:
if ! ${_somevar:-false}; then
		_somevar=true
	fi
(Consisent, slightly quicker, and slightly cleaner)
2003-01-04 15:27:43 +00:00
lukem 96e2ff62c8 Add two new rc.conf(5) variables:
rc_rcorder_flags		extra flags to rcorder(8) in /etc/rc
    rcshutdown_rcorder_flags	extra flags to rcorder(8) in /etc/rc.shutdown

This can be used to specify extra directories to search for rc.d scripts in.
For example, adding the following to rc.conf(5):
	rc_rcorder_flags="/usr/pkg/etc/rc.d/*"
	rcshutdown_rcorder_flags="/usr/pkg/etc/rc.d/*"
will add the files in /usr/pkg/etc/rc.d to the list of files that rcorder(8)
uses to build the list of scripts to start or stop.

I proposed this functionality on tech-userlevel@ over one month ago.
Closes the recent [misc/16888], which asked for a similar feature.
2002-05-19 01:01:32 +00:00
lukem 892c0453dd consistently set rc_(fast|force)=yes 2002-04-18 07:18:05 +00:00
lukem 1a286b1407 - Rename a bunch of "internal" run_rc_command() variables and officially
make them "externally" available:
	Previous	Current		Purpose
	--------	-------		-------
	_arg		rc_arg		Argument to command, after fast/force
					processing performed (and prefix
					removed)

	_flags		rc_flags	Flags to start the default command
					with.  Defaults to ${name}_flags,
					unless overridden by $flags from the
					environment.  This variable may be
					changed by the precmd method.

	_pid		rc_pid		PID of command (if appropriate).

	_rc_run_fast	rc_fast		Not empty is "fast" was provided.

	_rc_run_force	rc_force	Not empty is "force" was provided.

- Use rc_flags instead of _flags or ${name}_flags in various rc.d scripts,
  so that $flags from the environment overrides ${name}_flags from rc.conf(5).
  Fixes [bin/15800].
2002-03-22 04:16:38 +00:00
lukem bd7fad6c47 use symbolic signal names instead of numbers 2001-06-14 07:50:06 +00:00
lukem 28d6dbb5f3 explicitly set the umask to 022 to be safe 2001-05-09 16:53:45 +00:00
lukem b6742129e8 move date before rcorder 2001-03-12 15:56:39 +00:00
lukem c47a806047 various speed-ups (and related work):
- only load rc.conf if $_rc_conf_loaded is not set
- use case instead of if for various string comparisons
- print the date at the start of the boot as well as at the end
- if $rc_fast_and_loose is set, always run the rc.d scripts in the
  current shell rather than in a subshell. this is not on by default
  because it's potentially dangerous (a rogue command could terminate
  the boot), but it is provided as an optional speedup for people
  with slow machines that have an expensive fork
2001-02-28 16:49:18 +00:00
lukem 6eef11f223 - describe what rc.shutdown does, and what invokes it
- remove `.sh' suffix on script name in description
2000-12-15 00:00:09 +00:00
lukem 49533ad06e don't start rc.d scripts with a `nostart' keyword 2000-08-21 23:09:50 +00:00
lukem caa2beb10e revert previous; the fast-start functionality already existed, and
works at multi-user boot. (starting /etc/rc after single user boot
doesn't exhibit this fast start behaviour).
2000-04-22 03:01:22 +00:00
simonb 5e6480feca Add an "rc_fastboot" variable check in rc.subr, that if set adds
"fast" to the start of the run_rc_command arg.

/etc/rc calls each rc.d script with rc_fastboot=yes so that rc.subr
aware scripts to use "faststart" to skip the process running check.
2000-04-19 04:26:22 +00:00
enami e8b27ae5ed Check rc_configured also here, and bail out if it isn't set to yes. 2000-03-29 02:13:51 +00:00
lukem 8f8c6d6b2a run scripts in /etc/rc.d/* in the order returned by rcorder 2000-03-10 13:15:58 +00:00
jdolecek 020a8ac5b2 make clearing of /tmp after reboot configurable (default on), as per recent
discussion on current-users
2000-03-07 14:33:13 +00:00
itojun 7a0d226970 ip6forwarding -> ip6mode change (somehow i forgot to commit...)
PR: 9375
2000-02-09 16:24:03 +00:00
itojun e9056d34cb change IPv6 configuration syntax to avoid ambiguity.
ip6mode=host: IPv6 host
ip6mode=autohost: IPv6 host, with autoconfig
ip6mode=router: IPv6 router

backward compatibility to "ip6forwading" is provided.
2000-02-05 17:02:42 +00:00
jdc f58c419f41 Allow NFS servers to start up. 2000-01-31 12:47:29 +00:00
tron 7c5a18e4d2 Start automount daemon even if NFS client is not activated. This makes
sense for system where "amd" is used to mount local devices like e.g.
CD-ROM drives. Fixes PR misc/9126 by Bjoern Labitzke.
2000-01-19 12:00:49 +00:00
enami 5a3473733a Make some warning message consistient with others. 2000-01-19 03:52:12 +00:00
enami b07199995f Since the logger(1) puts space between its arguments, there is no need
to pass it explicitly.
2000-01-07 05:53:21 +00:00
enami f7c074aa48 Make sure that warning message starts from the beginning of line. Some
warning recently added didn't care about it.
2000-01-07 05:25:45 +00:00
enami 96e5a9b3d5 Cosmetic changes; folding long lines, using tab instead of spaces where
appropriate and fixing some indentation.
2000-01-07 05:11:43 +00:00
lukem 44ec789012 don't need to background xfs now that it auto-backgrounds itself... 2000-01-04 05:20:51 +00:00
hubertf 7bf20269f9 Add some boot time warnings:
- if ypserv=yes but portmap=no
 - if yppasswdd=yes but ypserv=no
 - if nfs_server=yes but portmap=no

Per discussion on tech-userlevel@netbsd.org.
1999-11-23 15:12:43 +00:00
lukem acc78cad94 accounting should be controllable via $accounting=YES in rc.conf... 1999-11-23 08:05:04 +00:00
fvdl 0f6157b181 Remove update, it's no longer used. 1999-11-15 20:04:50 +00:00
frueauf 1299db6b8b Use checkyesno to check the state of $rc_configured like for any other
variable set in /etc/rc.conf. Pointed out by Erik Bertelsen
<erik@mediator.uni-c.dk> in pr 8522.
1999-10-30 12:35:30 +00:00
darrenr 918f986a0c move old dev_mkdb and "kvm_mkdb /netbsd" up into the section which builds
kvm_mkdb based on machdep.boot_kernel. also failover to "kvm_mkdb /netbsd".
1999-10-05 10:54:27 +00:00
darrenr e463468294 send sysctl machdep errors to /dev/null
merge in patches to implement multiple bootup configurations (look for
/etc/etc.current, /etc/etc.default and friends)
only start up NFS services if either nfs_client or nfs_server is yes.
1999-10-05 10:32:56 +00:00
bouyer eac2fbdb83 Add support for $defcorename 1999-09-28 14:53:17 +00:00
darrenr 50e510e367 If machdep.booted_kernel can be found in sysctl output, feed that name into
kvm_mkdb so that when we boot we always have an upto-date kvm db, allowing
dmesg and friends to run without error when we do "boot netbsd.fun" to test
kernels, etc.
1999-09-16 11:00:44 +00:00
itojun 02972f5985 add sanity check on rtadvd invocation (allowed on IPv6 routers only).
add rc.conf entry for rtsold.
1999-09-03 13:40:15 +00:00
christos 4de82f14e2 check if vi recovery files are regular files before trying to e-mail them.
Stops a denial of service attack where the user can put a named pipe or
any other device that blocks i/o in /var/tmp/vi.recover/recover.*
[from dynamo@ime.net]
1999-08-28 03:39:59 +00:00
christos 6bac342db0 Create temp _motd file in /etc 1999-08-05 20:51:57 +00:00
itojun 94e64335b4 add IPv6 configuration (ip6forwarding, rtsol, route6d and rtadvd).
Right now netsetart does not bother you even if you do not have
"options INET6" in the kernel.
1999-07-03 03:29:29 +00:00
augustss aed7c5dbd9 usbd is dead. 1999-06-30 06:48:05 +00:00
tron 3cc8bf22d2 Configure wscons much earlier so that a virtual console can e.g. be
used for "syslogd" output.
1999-04-13 07:40:53 +00:00
cjs 668efbbcec Change mount_critical_filesystems() so that if given an argument
of "local" it will not mount filesystem types it identifies as
network file systems (currently just nfs). Call the function twice,
before networking starts with arg "local", after networking starts
with arg "network". Remove critfs_require_network as is now redundant.
1999-04-01 03:58:44 +00:00