inetd) started from rc can now be run under systrace by setting
${name}_systrace to a set of flags to be passed to systrace. Note
that policies need to generated before you do this.
in and setting -kb, check it out again, since the initial check in
trashes any RCSIDs (because -kb wasn't set at that time).
This stops the annoying situation where you add a new file (e.g, "foo")
which contains an RCSID and you get *two* notifications of differences
in two successives runs of /etc/security; the first when the file is
initially checked in and a second when diff finds the RCSID is different
(contains "foo.conf,v 1.1" instead of "foo,v 1.66").
Replace $critical_filesystems with $critical_filesystems_remote .
The new names are now consistent with the type argument that
mount_critical_filesystems() is called with, and allows for other types to
be easily supported by that function.
For backwards compatibility purposes, if the now obsolete variable is defined
(even empty), it takes precedence over the new form, and you will be warned.
If you want to stop the warnings, update your rc.conf(5) settings!
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].
If set, the first line of $command is read, the leading #! is
removed, whitespace is normalised, the first word is checked
against $command_interpreter, and the result is used as the
string to match in the ps(1) output.
This code isn't infallable, but works for common cases such as
#!/bin/sh
#! /usr/pkg/bin/perl -w
This helps solve the problem described in [bin/15563], and by
Ed Ravin on tech-userlevel.
- Move the common elements of check_process() and check_pidfile() into
_find_processes(), and call appropriately.
- Don't su(1) to ${name}_user if running as that user.
- Support $procname as the name of the process to search for.
Defaults to the value of $command.
I can't remember the rationale for why I made that change in the first place,
and there's been some good arguments presented to me as to why the rcvar
should be checked before status is run.
- always unset the variables used by run_rc_command() before sourcing an
rc.d script, rather than just when rc_fast_and_loose is in effect.
this allows run_rc_command() to be used in .sh scripts (with care).
- remove comment describing now-former limitation of .sh scripts.
- make the rc_fast_and_loose check only after the `` not *.sh / not scratch
/ script-is-executable '' checks. rc_fast_and_loose now behaves a lot more
like the normal operation, in that it skips scratch files and
non-executable files
- Skip files that end with `~', `#', `.OLD' or `.orig', as these are usually
scratch or backup files created by programs, and we don't want to start them.
- Only try and run non `.sh' files if they're executable.
Per discussions with Andrew Brown, and closing his PR [bin/9981].
* change the default `stop' case to wait_for_pids after kill $sig_stop.
this means that "/etc/rc.d/foo stop" won't return until the service
has shut down. third party scripts that implement their own stop mechanism
should offer this functionality as well.
* in the default restart case, don't bother doing `$0 poll' in between
stop & start, because of the change above. (XXX: deprecate poll ?)
because /bin/sh needs a different syntax than ksh (and bash, etc).
Use a more obvious and less error prone method. (This complicated
use of ${:+} was only used to build the su command when running as
a separate user, but could always cause problems.)
Problem noted by Hubert Feyrer in conjunction with /etc/rc.d/sshd.
* run_rc_command():
- add support for "poll", which by default, uses wait_for_pids() on
the list of matching processes
- in the "restart" case, call "poll" between "stop" and "start"
this fixes the situation where certain services (e.g, amd, squid) would
take a bit longer to shutdown after receiving the kill signal to shutdown,
and "/etc/rc.d/foo restart" would fail in the `start' phase.
- 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
* don't barf if `force' is used and $rcvar isn't set by the script
* only do the guts of `restart' once, by setting _rc_restart_done after the
first run through. this stops scripts which call run_rc_command more than
once (such as nfslocking) from doing the ``stop everything/start everything''
sequence n times.
implicitly using $name if $rcvar isn't set), and always perform this check,
even when using start_cmd (et al).
this check is performed before the pidcmd
is run, speeding up scripts that weren't going to be run anyway.
this should speed up booting slow systems.
- take advantage of the above and remove
start_precmd="checkyesno foo"
in scripts that use start_cmd.
- explicitly set rcvar=foo in the rc.d/foo scripts which have an equivalent
rc.conf entry
- fix `rcvar' and `restart' when $rcvar isn't set.
these above changes fix PR [bin/11027].
- when doing `force*', ignore the return value of *_precmd.
this fixes PR [bin/10781].
- rename what sysdb provides from `databases' to `sysdb', to reflect
the name of the script.
- improve the comments in rc.subr
allow changing the user credentials to ${name}_user, ${name}_group,
and ${name}_groups as part of this. if ${name}_chroot is used, the following
variables won't work: ${name}_chdir and ${name}_nice.
[requested by mrg; whipped up in a few minutes on his terminal :-]
(/etc/rc.conf.d/X), then it is sourced in addition of /etc/rc.conf
This means that the base system will still use rc.conf, but that
3rd party scripts can use rc.conf.d
Currently this just loads /etc/rc.conf, but this will make it easier
for us and users to modify the config mechanism without modifying all
of /etc/rc.d/*.
- ${name}_chdir directory to cd to before running ${command}
- ${name}_nice nice level to run ${command} at
- ${name}_user user to run ${command} as
based on [misc/9954] by Dave Sainty <dave@dtsp.co.nz>, except that it works :)
from a variable ($extra_commands) as opposed to from $2-* on the
argument list. it's cleaner; and allows for the possibility of
multiple command arguments being passed to run_rc_command() in the
future.
"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.
check_pidfile parse a pidfile for a pid, checking that the
process is running, and print the matching pid
check_process print a list of running pids that match the procname
run_rc_command kitchen sink function to simplify creation of
rc.d scripts
run_rc_script invoke an rc.d script appropriately
rc_usage print a usage string for an rc.d script
err similar to err(3)
warn similar to warn(3)
* add copyright
* remove islocalfs(); nothing uses it
"/usr" must be mounted. mount_critical_filesystems() didn't mount it,
even if listed in "critical_filesystems", if it is nfs.
Solution: introduce another rc.conf variable
"critical_filesystems_beforenet" which contains filesystems to be mounted
before "netstart".
Perhaps "netstart" should be split up, but this would make things even
more complex...
rc.subr to the default rc.conf.
While this is no longer necessary to supress noise,
it increases the clarity of the situation and removes
one more bit of what should be adjustable configuration
from scripts that site admins shouldn't have to edit.
Addresses PRs misc/7406 and (partially) bin/7491.
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.
switch and a set of flags. Get rid of DEFAULT flags entirely. Print
warnings if on/off switches are not set, or are set incorrectly.
Add a shell function to simplify this on/off switch testing.