#
1.111 |
|
22-May-2022 |
andvar |
fix various small typos, mainly in comments.
|
#
1.110 |
|
06-Feb-2022 |
alnsn |
Small changes in mount_critical_filesystems_zfs
avoid unnecessary eval, switch to $() and -ne.
from kre@, thanks!
|
#
1.109 |
|
03-Feb-2022 |
alnsn |
Compare $_mount_es with 0
|
#
1.108 |
|
03-Feb-2022 |
alnsn |
Add mount_critical_filesystems_zfs
The new function is similar to mount_critical_filesystems but it walks through ZFS datasets and mounts matching entries.
|
#
1.107 |
|
06-Nov-2021 |
christos |
Set the path unconditionally to what rc sets it to, so that when running individual scripts like 'env - /etc/rc.d/syslogd restart' programs like rcorder are found.
|
Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
|
#
1.106 |
|
20-Dec-2020 |
uwe |
run_rc_command - don't prefix the rcvar variable name with the dollar sign.
The output without the dollar sign is less confusing as it's actual valid shell syntax:
$ /etc/rc.d/foo rcvar # food food=YES
Brought up on tech-userlevel@ by Rocky Hotas with some LGTMs from other people and no objections.
We still refer to '$food' in warnings/errors though.
|
#
1.105 |
|
17-Sep-2020 |
otis |
Fix waiting for PIDs on stop.
Fix expansion of positional parameters. Also move the local variable declaration to more apropriate place.
|
Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
|
#
1.104 |
|
05-Apr-2020 |
christos |
Prevent waiting for processes to exit forever by introducing _rc_kill_ntries, which if set, will SIGKILL the processes that did not die yet.
|
Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE is-mlppp-base netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930
|
#
1.103 |
|
23-Sep-2018 |
kre |
rc.subr can be used in install images (from sysinst) so must use only POSIX specified test uses (no -a or -o). Also, use printf always, rather than echo (replace echo as a function using echo with one which uses printf).
|
Revision tags: pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
|
#
1.102 |
|
11-Apr-2018 |
christos |
branches: 1.102.2; Hide ps error about processes not found (we could be more specific...) It is superfluous, since we print: foo not running? (check /var/run/foo/foo.pid).
|
Revision tags: pgoyette-compat-0407
|
#
1.101 |
|
01-Apr-2018 |
kre |
PR misc/53145 (Bruce Lilly)
Use ps -A instead of ps -ax (-A means -ax, but -A is posix, -x is not) Use ps -o args instead of ps -o command (same reason).
This makes no difference when the ps used is /bin/ps on NetBSD, but can make a difference when some other ps command gets invoked instead.
XXX pullup -8
|
Revision tags: pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
|
#
1.100 |
|
13-Apr-2017 |
christos |
branches: 1.100.4; 1.100.10; remove env.
|
#
1.99 |
|
21-Mar-2017 |
christos |
Clear rc variables that contain state that is gone after the boot process is complete, so that scripts invoked from powerd don't think that they are still invoked by the rc system and fail. Reported by rudolf @ tech-userlevel
|
Revision tags: pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
|
#
1.98 |
|
06-Mar-2016 |
christos |
branches: 1.98.2; 1.98.4; Introduce kat() a built-in version of cat(1) that strips shell-like comments.
|
#
1.97 |
|
31-Oct-2015 |
phx |
PR misc/50046 Remove the expensive tests in _have_rc_postprocessor(), as proposed by apb@. It more than halves the multiuser boot time on slow machines and brings it back near to the previous level.
|
#
1.96 |
|
07-Oct-2014 |
roy |
sleep for 0.05 seconds instead of 2 seconds when checking if the pids are still alive for a much faster exit.
|
#
1.95 |
|
21-Sep-2014 |
roy |
Add checkyesnox function so we can test a configurable without being warned of its non-existance.
|
Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
|
#
1.94 |
|
27-Jul-2014 |
apb |
branches: 1.94.2; 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.
|
#
1.93 |
|
22-Jul-2014 |
wiz |
'file system' for consistency with documentation (instead of 'filesystem').
|
Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
|
#
1.92 |
|
17-Dec-2012 |
apb |
branches: 1.92.8; Add shell implementations of basename and dirname to rc.subr. They are supposed to mimic basename(1) and dirname(1), except that they are usable before /usr/bin is mounted.
|
Revision tags: yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
|
#
1.91 |
|
07-Apr-2012 |
christos |
branches: 1.91.2; back out change that makes onestart work, to be committed at some other time.
|
#
1.90 |
|
07-Apr-2012 |
christos |
give wedges to everyone
|
#
1.89 |
|
07-Apr-2012 |
apb |
The error message when /var is not a file system chhanged from mount: unknown special file or file system `/var' to mount: Unknown special file or file system `/var' so match them both.
|
Revision tags: netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.88 |
|
11-Aug-2011 |
apb |
branches: 1.88.2; 1.88.4; 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.
|
#
1.87 |
|
09-Jun-2011 |
christos |
PR/42642: Ed Ravin: Handle daemons that start with #!/usr/bin/env interp
|
Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.86 |
|
26-Sep-2010 |
apb |
branches: 1.86.4; Add a collapse_backslash_newline function to rc.subr.
|
#
1.85 |
|
08-Jun-2010 |
christos |
use modulo instead of logical and. from pooka
|
#
1.84 |
|
08-Jun-2010 |
christos |
explain why this code is there.
|
#
1.83 |
|
06-Jun-2010 |
christos |
fix conditional, from dholland.
|
#
1.82 |
|
04-Jun-2010 |
christos |
print human readable exit code.
|
#
1.81 |
|
15-Mar-2010 |
jmmv |
Allow the run_rc_command function in rc.subr to pass extra parameters to the command being executed. This is to allow rc.d scripts to do:
run_rc_command "${@}"
instead of:
run_rc_command "${1}"
and let the command handler (start, stop, etc.) receive the arguments after the command name.
None of the default commands allow extra arguments, and they will error out if any are given. This is mostly useful for script-specific commands that are only supposed to be used through the command line and, therefore, need to provide a friendly interface.
Proposed in tech-userlevel@. No major objections except for some minor concerns regarding whether this should be allowed or not at all. Note that I'm not touching any of the rc.d scripts in the base system, so this is effectively a no-op from the user point of view.
|
Revision tags: matt-premerge-20091211
|
#
1.80 |
|
14-Sep-2009 |
apb |
Fix some errors in the way scripts with "KEYWORD: interactive" are handled. There was an inverted test, and "set $_args" had the wrong scope (in several nearly-identical blocks of code).
|
#
1.79 |
|
14-Sep-2009 |
apb |
Add the ability for file systems mounted via mount_critical_filesystems() in rc.subr to be marked as optional. This means that it's not an error if the file system is not mentioned in /etc/fstab. It is still an error if something else goes wrong.
Change the defaults for these two variables in /etc/defaults/rc.conf: critical_filesystems_local="OPTIONAL:/var" critical_filesystems_remote="OPTIONAL:/usr"
|
#
1.78 |
|
11-Sep-2009 |
apb |
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.
|
#
1.77 |
|
05-Sep-2009 |
apb |
Change multiple spaces to tabs on one line
|
#
1.76 |
|
10-Jul-2009 |
christos |
1. centralize the fsck error handling 2. don't check if root is on nfs 3. reboot -n if root was modified as the manual page suggests
|
Revision tags: jym-xensuspend-nbase jym-xensuspend-base
|
#
1.75 |
|
28-Apr-2009 |
reed |
Get rid of extra space in Usage statement.
|
Revision tags: mjf-devfs2-base2
|
#
1.74 |
|
06-Dec-2008 |
salo |
branches: 1.74.2; A very old patch sitting in my tree..
When rc scripts are started from interactive shell, be nice and when user tries to start an unconfigured service, point him to rc.conf(5) and tell him about the one* keyword. Also be more user friendly when an unknown argument is entered.
Example:
# /etc/rc.d/cron start $cron is not enabled - see rc.conf(5). Use the following if you wish to perform the operation: /etc/rc.d/cron onestart
# /etc/rc.d/cron nonsense /etc/rc.d/cron: unknown directive 'nonsense'. Usage: /etc/rc.d/cron [fast|force|one](start stop restart rcvar status poll)
Inspired by discussion on tech-userlevel:
http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0010.html http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0011.html http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0012.html
Reminded about it and reviewed by <lukem>
|
Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 mjf-devfs2-base
|
#
1.73 |
|
23-Jun-2008 |
dholland |
branches: 1.73.2; fix typo
|
Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
|
#
1.72 |
|
22-May-2008 |
he |
Add support for optionally setting some environment variables before starting ${command}, via ${name}_env.
Discussed with lukem.
|
Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2
|
#
1.71 |
|
30-Apr-2008 |
martin |
branches: 1.71.2; Convert TNF licenses to new 2 clause variant
|
Revision tags: yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-base mjf-devfs-base matt-armv6-nbase matt-armv6-base hpcarm-cleanup-base
|
#
1.70 |
|
31-Dec-2007 |
ad |
branches: 1.70.2; 1.70.6; 1.70.8; Remove systrace. Ok core@.
|
Revision tags: matt-armv6-prevmlocking cube-autoconf-base matt-mips64-base
|
#
1.69 |
|
06-Apr-2007 |
apb |
branches: 1.69.4; * Add a stop_boot() function in rc.subr, to terminate a multi-user boot by killing the parent process. The parent's PID is saved in $RC_PID. * In all rc.d/* scripts that previously tried to stop the boot, replace in-line code with "stop_boot". * Document this.
This should fix PR 29822.
|
#
1.68 |
|
27-Jan-2007 |
hubertf |
_find_processes(): in addition to the existing "interpreter: /path/to/daemon" also recognize "interpreter: daemon" in ps(1) output.
That case statement should be rewritten with expr(1) if more flexibility is needed.
Fixes PR 35366 by Dominik Joe Pantucek, debugged with much assistance by him on IRC.
|
Revision tags: netbsd-4-base
|
#
1.67 |
|
07-Oct-2006 |
elad |
branches: 1.67.2; PR/32004: Ed Ravin: command interpreter test in rc.subr doesn't accomodate chroots
Patch applied, thanks!
okay apb@
|
Revision tags: abandoned-netbsd-4-base
|
#
1.66 |
|
01-Apr-2006 |
he |
In order to handle some perl scripts running as daemons, add a pattern which also matches "`basename $interpreter`: $command" in the ps listing. Should fix PR#31932.
|
Revision tags: netbsd-3-0-3-RELEASE netbsd-3-0-2-RELEASE netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
|
#
1.65 |
|
12-Oct-2004 |
lukem |
branches: 1.65.2; * Implement load_rc_config_var cmd var to load the rc.conf(5) configuration for cmd and set var in the current shell, using 'load_rc_config var' in a sub-shell to avoid unwanted side-effects.
* Improve required_vars warning message.
|
#
1.64 |
|
13-Aug-2004 |
mycroft |
Add an _rc_subr_loaded variable, set to ":" by rc.subr. Scripts can use this for a speedup by doing: $_rc_subr_loaded . /etc/rc.subr
|
#
1.63 |
|
03-May-2004 |
lukem |
When performing "start", "stop" or "reload" in run_rc_command(), send any "<name> already running" or "<name> not running" messages to stderr instead of stdout before the (existing) non-zero exit.
|
#
1.62 |
|
02-Apr-2004 |
jmmv |
Introduce and use the rcvar_manpage variable, which contains the manual page name where the user should look at for documentation about rcvar. It defaults to 'rc.subr(5)', as rc.subr is mainly used by rc.d scripts.
This variable is useful to let the daily, weekly, monthly and security scripts tune the warning message shown when any of the variables they handle is not properly set.
Closes PR misc/23908.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.61 |
|
06-Jan-2004 |
lukem |
branches: 1.61.4; Implement ``one'' prefix to allow a "one shot" operation as if ${rcvar}=yes yet all the other prerequisite tests are still performed. The existing ``force'' prefix is a sledgehammer that ignores all the prerequisite checks and always returns a zero exit status; this is a more gentle approach to the problem of "manipulate this disabled service without editing rc.conf(5)".
|
#
1.60 |
|
26-Jul-2003 |
lukem |
Add "*,v" to the list of scratch files to skip. Suggested by Johnny Lam / Alistair Crooks
|
#
1.59 |
|
04-Jul-2003 |
lukem |
Revert previous; the "return" if rc.subr had already loaded had issues in some circumstances where run_rc_script()'s sourcing of an rc.d file which then sourced rc.subr, the `optimisation' in rc.subr to "return as we're already loaded" would finish more than just the inner-most sourcing. I haven't tracked down the exact issue, but removing the `optimisation' fixes the problem I noticed in starting up certain rc.d scripts, and may fix [bin/22053] as well.
|
#
1.58 |
|
27-Jun-2003 |
lukem |
If _rc_subr_loaded=true, "return" immediately, otherwise set that var and continue as normal. Gains ~ 2 seconds on 110 runs of ". rc.subr" on a shark. Suggested by Andrew Cagney in [bin/18400]
|
#
1.57 |
|
27-Jun-2003 |
lukem |
run_rc_command(): when checking if ${command} exists before executing it, be sure to check under ${name_chroot} (if set). Fix from Ed Ravin in [bin/18523]
|
#
1.56 |
|
03-Jun-2003 |
christos |
Use more concise shell syntax: 1. for i in $* -> for i 2. foo=$* -> foo="$@"
|
#
1.55 |
|
05-Jan-2003 |
lukem |
Fix logic error I introduced recently into mount_critical_filesystems(). Noted by kilbi@rad.rwth-aachen.de in [bin/19703].
|
#
1.54 |
|
05-Jan-2003 |
lukem |
'if ! command;' is not POSIX sh, even though our /bin/sh supports it
|
#
1.53 |
|
04-Jan-2003 |
lukem |
Change how internal boolean variables are used to: if ! ${_somevar:-false}; then _somevar=true fi (Consisent, slightly quicker, and slightly cleaner)
|
Revision tags: fvdl_fs64_base
|
#
1.52 |
|
26-Aug-2002 |
abs |
Append ' - see rc.conf(5)' to unset variable warning: /etc/rc.d/fu: WARNING: $fu is not set properly - see rc.conf(5). Add a note to rc.conf that third party packages may test for additional variables.
|
#
1.51 |
|
25-Jul-2002 |
grant |
add test for /usr/bin/logger in warn/err.
|
#
1.50 |
|
08-Jul-2002 |
atatat |
Add systrace(1) support to rc.subr. Most services (eg, ${name} is 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.
|
Revision tags: netbsd-1-6-base
|
#
1.49 |
|
21-May-2002 |
lukem |
branches: 1.49.2; When using backup_uses_rcs=YES in backup_file(), after checking the file 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").
|
#
1.48 |
|
18-Apr-2002 |
lukem |
consistently set rc_(fast|force)=yes
|
#
1.47 |
|
27-Mar-2002 |
lukem |
Replace $critical_filesystems_beforenet with $critical_filesystems_local . 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!
|
#
1.46 |
|
22-Mar-2002 |
lukem |
- 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].
|
#
1.45 |
|
21-Mar-2002 |
lukem |
- Add run_rc_command() control variable $command_interpreter 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.
|
#
1.44 |
|
13-Mar-2002 |
lukem |
Use ${_arg}_postcmd even if we're not using the default ${_arg}_cmd method.
|
#
1.43 |
|
13-Mar-2002 |
lukem |
Implement ${_arg}_postcmd support, which is run if a default start/stop/reload/restart operation succeeds (i.e, zero exit code). Code from Lubomir Sedlacik <salo@Xtrmntr.org>.
|
#
1.42 |
|
25-Feb-2002 |
lukem |
Fixes derived from [bin/15563] submitted by Ron Roskens: - 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.
|
#
1.41 |
|
25-Feb-2002 |
lukem |
fix spelo. crank copyright year
|
#
1.40 |
|
25-Feb-2002 |
lukem |
Don't run "status" as if "force" is set, thus reverting part of rev 1.29. 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.
|
#
1.39 |
|
25-Feb-2002 |
lukem |
run_rc_script() improvements: - 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
|
#
1.38 |
|
19-Nov-2001 |
lukem |
Add reverse_list(), which prints the reverse of the list of words. Doesn't attempt to handle words with whitespace, etc.
|
#
1.37 |
|
18-Jun-2001 |
lukem |
Improve run_rc_script(): - 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].
|
#
1.36 |
|
10-May-2001 |
atatat |
When using rcs to track backups, force the rcs archive to be unlocked, use only non-strict locking, and leave the archives unlocked after checking in changes.
|
#
1.35 |
|
09-May-2001 |
lukem |
* change wait_for_pids() to spin forever (rather than just ~ 65 seconds). * 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 ?)
|
#
1.34 |
|
07-May-2001 |
lukem |
Don't try and use single quotes in the RHS of a ${ :+ } expansion 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.
|
#
1.33 |
|
18-Apr-2001 |
lukem |
* provide wait_for_pids(), which spins until all the given pids don't exist * 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.
|
#
1.32 |
|
06-Apr-2001 |
lukem |
clarify that ${name}_groups is comma separated
|
#
1.31 |
|
04-Apr-2001 |
atatat |
Provide the capability of storing backups via RCS instead of just a "current" and a "last" (which is useless if you wanna know what you changed last week). Set the default to on.
|
#
1.30 |
|
28-Feb-2001 |
lukem |
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
|
#
1.29 |
|
17-Nov-2000 |
lukem |
* always run `status'; i.e, ignore the setting of $rcvar just like `rcvar' does. * 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.
|
#
1.28 |
|
06-Nov-2000 |
lukem |
when doing `status', return non-zero if the program isn't running. request by thorpej.
|
#
1.27 |
|
05-Nov-2000 |
lukem |
when running `forcerestart', call the underlying `stop' and `start' with the `force' prefix as well
|
#
1.26 |
|
07-Oct-2000 |
lukem |
use ${foo##*/} instead of `basename $foo`. as suggested (with minor variation) by Toru Nishimura <nisimura@itc.aist-nara.ac.jp>
|
#
1.25 |
|
01-Oct-2000 |
lukem |
remove unnecessary leading `$' on warnings printed for $required_dirs and $required_files.
|
#
1.24 |
|
19-Sep-2000 |
lukem |
- only perform the checkyesno on the variable named in $rcvar (rather than 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
|
#
1.23 |
|
19-Aug-2000 |
lukem |
support ${name}_nice even when using ${name}_chroot. per discussion with mrg...
|
#
1.22 |
|
17-Aug-2000 |
lukem |
add support for ${name}_chroot, which chroot(8)s before running the command. 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 :-]
|
#
1.21 |
|
20-Jul-2000 |
lukem |
in err() and warn() put a : between the ERROR/WARNING label and the message
|
Revision tags: netbsd-1-5-base
|
#
1.20 |
|
09-Jun-2000 |
fvdl |
branches: 1.20.2; Add and rc.conf.d directory. If a config file for command X exists (/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
|
Revision tags: minoura-xpg4dl-base
|
#
1.19 |
|
13-May-2000 |
lukem |
branches: 1.19.2; Implement load_rc_config(), which takes the config name as an argument. 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/*.
|
#
1.18 |
|
13-May-2000 |
lukem |
implement three new variables for run_rc_command: - ${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 :)
|
#
1.17 |
|
30-Apr-2000 |
lukem |
- prefix some more local variables with `_' (when you have a convention, stick to it :-) - simplify run_rc_script (no need to support fast* or force* here...) - clarify some comments
|
#
1.16 |
|
30-Apr-2000 |
lukem |
change run_rc_command() to take the list of extra commands supported 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.
|
#
1.15 |
|
28-Apr-2000 |
lukem |
in check_pidfile and check_process, also match "(" + `basename prog` + ")" . noted by veego@
|
#
1.14 |
|
26-Apr-2000 |
lukem |
don't bother checking rc_configured each time run_rc_command executes; once in /etc/rc is enough
|
#
1.13 |
|
22-Apr-2000 |
lukem |
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).
|
#
1.12 |
|
19-Apr-2000 |
simonb |
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.
|
#
1.11 |
|
10-Mar-2000 |
lukem |
* add: 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
|
Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
|
#
1.10 |
|
07-Jul-1999 |
drochner |
repair diskless startup: "netstart" needs "sysctl" and "awk" now, thus "/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...
|
#
1.9 |
|
28-Apr-1999 |
nathanw |
Move the knowledge that /usr and /var should be mounted early from 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.
|
#
1.8 |
|
13-Apr-1999 |
cjs |
When checking local status, jJust ignore not-found filesystems, rather than printing an error, just as we do when we try to mount it.
|
Revision tags: netbsd-1-4-base
|
#
1.7 |
|
01-Apr-1999 |
cjs |
branches: 1.7.2; 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.
|
#
1.6 |
|
24-Mar-1999 |
mellon |
- Move critical filesystem mounting code into a shell function and put that in rc.subr. - Support critfs_require_network rc.conf variable.
|
#
1.5 |
|
28-Feb-1998 |
lukem |
improve description comment
|
#
1.4 |
|
28-Feb-1998 |
lukem |
* add synonyms for "yes": "true", "on", and "1" * add synonyms for "no": "false", "off", and "0" * remove unnecessary trailing semicolons (this is sh, not C)
|
#
1.3 |
|
26-Jan-1998 |
lukem |
convert 'if .. else .. fi' into a 'case .. esac', and allow for any uppercase/lowercase variations of 'yes' and 'no'. fixes [misc/4887] sent in by "John F. Woods" <jfw@jfwhome.funhouse.com>
|
Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
|
#
1.2 |
|
30-Aug-1997 |
cjs |
Prune unused function.
|
#
1.1 |
|
29-Aug-1997 |
cjs |
Split rc.conf variables for starting programs into two: an on/off 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.
|
#
1.110 |
|
06-Feb-2022 |
alnsn |
Small changes in mount_critical_filesystems_zfs
avoid unnecessary eval, switch to $() and -ne.
from kre@, thanks!
|
#
1.109 |
|
03-Feb-2022 |
alnsn |
Compare $_mount_es with 0
|
#
1.108 |
|
03-Feb-2022 |
alnsn |
Add mount_critical_filesystems_zfs
The new function is similar to mount_critical_filesystems but it walks through ZFS datasets and mounts matching entries.
|
#
1.107 |
|
06-Nov-2021 |
christos |
Set the path unconditionally to what rc sets it to, so that when running individual scripts like 'env - /etc/rc.d/syslogd restart' programs like rcorder are found.
|
Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
|
#
1.106 |
|
20-Dec-2020 |
uwe |
run_rc_command - don't prefix the rcvar variable name with the dollar sign.
The output without the dollar sign is less confusing as it's actual valid shell syntax:
$ /etc/rc.d/foo rcvar # food food=YES
Brought up on tech-userlevel@ by Rocky Hotas with some LGTMs from other people and no objections.
We still refer to '$food' in warnings/errors though.
|
#
1.105 |
|
17-Sep-2020 |
otis |
Fix waiting for PIDs on stop.
Fix expansion of positional parameters. Also move the local variable declaration to more apropriate place.
|
Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
|
#
1.104 |
|
05-Apr-2020 |
christos |
Prevent waiting for processes to exit forever by introducing _rc_kill_ntries, which if set, will SIGKILL the processes that did not die yet.
|
Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE is-mlppp-base netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930
|
#
1.103 |
|
23-Sep-2018 |
kre |
rc.subr can be used in install images (from sysinst) so must use only POSIX specified test uses (no -a or -o). Also, use printf always, rather than echo (replace echo as a function using echo with one which uses printf).
|
Revision tags: pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
|
#
1.102 |
|
11-Apr-2018 |
christos |
branches: 1.102.2; Hide ps error about processes not found (we could be more specific...) It is superfluous, since we print: foo not running? (check /var/run/foo/foo.pid).
|
Revision tags: pgoyette-compat-0407
|
#
1.101 |
|
01-Apr-2018 |
kre |
PR misc/53145 (Bruce Lilly)
Use ps -A instead of ps -ax (-A means -ax, but -A is posix, -x is not) Use ps -o args instead of ps -o command (same reason).
This makes no difference when the ps used is /bin/ps on NetBSD, but can make a difference when some other ps command gets invoked instead.
XXX pullup -8
|
Revision tags: pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
|
#
1.100 |
|
13-Apr-2017 |
christos |
branches: 1.100.4; 1.100.10; remove env.
|
#
1.99 |
|
21-Mar-2017 |
christos |
Clear rc variables that contain state that is gone after the boot process is complete, so that scripts invoked from powerd don't think that they are still invoked by the rc system and fail. Reported by rudolf @ tech-userlevel
|
Revision tags: pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
|
#
1.98 |
|
06-Mar-2016 |
christos |
branches: 1.98.2; 1.98.4; Introduce kat() a built-in version of cat(1) that strips shell-like comments.
|
#
1.97 |
|
31-Oct-2015 |
phx |
PR misc/50046 Remove the expensive tests in _have_rc_postprocessor(), as proposed by apb@. It more than halves the multiuser boot time on slow machines and brings it back near to the previous level.
|
#
1.96 |
|
07-Oct-2014 |
roy |
sleep for 0.05 seconds instead of 2 seconds when checking if the pids are still alive for a much faster exit.
|
#
1.95 |
|
21-Sep-2014 |
roy |
Add checkyesnox function so we can test a configurable without being warned of its non-existance.
|
Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
|
#
1.94 |
|
27-Jul-2014 |
apb |
branches: 1.94.2; 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.
|
#
1.93 |
|
22-Jul-2014 |
wiz |
'file system' for consistency with documentation (instead of 'filesystem').
|
Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
|
#
1.92 |
|
17-Dec-2012 |
apb |
branches: 1.92.8; Add shell implementations of basename and dirname to rc.subr. They are supposed to mimic basename(1) and dirname(1), except that they are usable before /usr/bin is mounted.
|
Revision tags: yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
|
#
1.91 |
|
07-Apr-2012 |
christos |
branches: 1.91.2; back out change that makes onestart work, to be committed at some other time.
|
#
1.90 |
|
07-Apr-2012 |
christos |
give wedges to everyone
|
#
1.89 |
|
07-Apr-2012 |
apb |
The error message when /var is not a file system chhanged from mount: unknown special file or file system `/var' to mount: Unknown special file or file system `/var' so match them both.
|
Revision tags: netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.88 |
|
11-Aug-2011 |
apb |
branches: 1.88.2; 1.88.4; 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.
|
#
1.87 |
|
09-Jun-2011 |
christos |
PR/42642: Ed Ravin: Handle daemons that start with #!/usr/bin/env interp
|
Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.86 |
|
26-Sep-2010 |
apb |
branches: 1.86.4; Add a collapse_backslash_newline function to rc.subr.
|
#
1.85 |
|
08-Jun-2010 |
christos |
use modulo instead of logical and. from pooka
|
#
1.84 |
|
08-Jun-2010 |
christos |
explain why this code is there.
|
#
1.83 |
|
06-Jun-2010 |
christos |
fix conditional, from dholland.
|
#
1.82 |
|
04-Jun-2010 |
christos |
print human readable exit code.
|
#
1.81 |
|
15-Mar-2010 |
jmmv |
Allow the run_rc_command function in rc.subr to pass extra parameters to the command being executed. This is to allow rc.d scripts to do:
run_rc_command "${@}"
instead of:
run_rc_command "${1}"
and let the command handler (start, stop, etc.) receive the arguments after the command name.
None of the default commands allow extra arguments, and they will error out if any are given. This is mostly useful for script-specific commands that are only supposed to be used through the command line and, therefore, need to provide a friendly interface.
Proposed in tech-userlevel@. No major objections except for some minor concerns regarding whether this should be allowed or not at all. Note that I'm not touching any of the rc.d scripts in the base system, so this is effectively a no-op from the user point of view.
|
Revision tags: matt-premerge-20091211
|
#
1.80 |
|
14-Sep-2009 |
apb |
Fix some errors in the way scripts with "KEYWORD: interactive" are handled. There was an inverted test, and "set $_args" had the wrong scope (in several nearly-identical blocks of code).
|
#
1.79 |
|
14-Sep-2009 |
apb |
Add the ability for file systems mounted via mount_critical_filesystems() in rc.subr to be marked as optional. This means that it's not an error if the file system is not mentioned in /etc/fstab. It is still an error if something else goes wrong.
Change the defaults for these two variables in /etc/defaults/rc.conf: critical_filesystems_local="OPTIONAL:/var" critical_filesystems_remote="OPTIONAL:/usr"
|
#
1.78 |
|
11-Sep-2009 |
apb |
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.
|
#
1.77 |
|
05-Sep-2009 |
apb |
Change multiple spaces to tabs on one line
|
#
1.76 |
|
10-Jul-2009 |
christos |
1. centralize the fsck error handling 2. don't check if root is on nfs 3. reboot -n if root was modified as the manual page suggests
|
Revision tags: jym-xensuspend-nbase jym-xensuspend-base
|
#
1.75 |
|
28-Apr-2009 |
reed |
Get rid of extra space in Usage statement.
|
Revision tags: mjf-devfs2-base2
|
#
1.74 |
|
06-Dec-2008 |
salo |
branches: 1.74.2; A very old patch sitting in my tree..
When rc scripts are started from interactive shell, be nice and when user tries to start an unconfigured service, point him to rc.conf(5) and tell him about the one* keyword. Also be more user friendly when an unknown argument is entered.
Example:
# /etc/rc.d/cron start $cron is not enabled - see rc.conf(5). Use the following if you wish to perform the operation: /etc/rc.d/cron onestart
# /etc/rc.d/cron nonsense /etc/rc.d/cron: unknown directive 'nonsense'. Usage: /etc/rc.d/cron [fast|force|one](start stop restart rcvar status poll)
Inspired by discussion on tech-userlevel:
http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0010.html http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0011.html http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0012.html
Reminded about it and reviewed by <lukem>
|
Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 mjf-devfs2-base
|
#
1.73 |
|
23-Jun-2008 |
dholland |
branches: 1.73.2; fix typo
|
Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
|
#
1.72 |
|
22-May-2008 |
he |
Add support for optionally setting some environment variables before starting ${command}, via ${name}_env.
Discussed with lukem.
|
Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2
|
#
1.71 |
|
30-Apr-2008 |
martin |
branches: 1.71.2; Convert TNF licenses to new 2 clause variant
|
Revision tags: yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-base mjf-devfs-base matt-armv6-nbase matt-armv6-base hpcarm-cleanup-base
|
#
1.70 |
|
31-Dec-2007 |
ad |
branches: 1.70.2; 1.70.6; 1.70.8; Remove systrace. Ok core@.
|
Revision tags: matt-armv6-prevmlocking cube-autoconf-base matt-mips64-base
|
#
1.69 |
|
06-Apr-2007 |
apb |
branches: 1.69.4; * Add a stop_boot() function in rc.subr, to terminate a multi-user boot by killing the parent process. The parent's PID is saved in $RC_PID. * In all rc.d/* scripts that previously tried to stop the boot, replace in-line code with "stop_boot". * Document this.
This should fix PR 29822.
|
#
1.68 |
|
27-Jan-2007 |
hubertf |
_find_processes(): in addition to the existing "interpreter: /path/to/daemon" also recognize "interpreter: daemon" in ps(1) output.
That case statement should be rewritten with expr(1) if more flexibility is needed.
Fixes PR 35366 by Dominik Joe Pantucek, debugged with much assistance by him on IRC.
|
Revision tags: netbsd-4-base
|
#
1.67 |
|
07-Oct-2006 |
elad |
branches: 1.67.2; PR/32004: Ed Ravin: command interpreter test in rc.subr doesn't accomodate chroots
Patch applied, thanks!
okay apb@
|
Revision tags: abandoned-netbsd-4-base
|
#
1.66 |
|
01-Apr-2006 |
he |
In order to handle some perl scripts running as daemons, add a pattern which also matches "`basename $interpreter`: $command" in the ps listing. Should fix PR#31932.
|
Revision tags: netbsd-3-0-3-RELEASE netbsd-3-0-2-RELEASE netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
|
#
1.65 |
|
12-Oct-2004 |
lukem |
branches: 1.65.2; * Implement load_rc_config_var cmd var to load the rc.conf(5) configuration for cmd and set var in the current shell, using 'load_rc_config var' in a sub-shell to avoid unwanted side-effects.
* Improve required_vars warning message.
|
#
1.64 |
|
13-Aug-2004 |
mycroft |
Add an _rc_subr_loaded variable, set to ":" by rc.subr. Scripts can use this for a speedup by doing: $_rc_subr_loaded . /etc/rc.subr
|
#
1.63 |
|
03-May-2004 |
lukem |
When performing "start", "stop" or "reload" in run_rc_command(), send any "<name> already running" or "<name> not running" messages to stderr instead of stdout before the (existing) non-zero exit.
|
#
1.62 |
|
02-Apr-2004 |
jmmv |
Introduce and use the rcvar_manpage variable, which contains the manual page name where the user should look at for documentation about rcvar. It defaults to 'rc.subr(5)', as rc.subr is mainly used by rc.d scripts.
This variable is useful to let the daily, weekly, monthly and security scripts tune the warning message shown when any of the variables they handle is not properly set.
Closes PR misc/23908.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.61 |
|
06-Jan-2004 |
lukem |
branches: 1.61.4; Implement ``one'' prefix to allow a "one shot" operation as if ${rcvar}=yes yet all the other prerequisite tests are still performed. The existing ``force'' prefix is a sledgehammer that ignores all the prerequisite checks and always returns a zero exit status; this is a more gentle approach to the problem of "manipulate this disabled service without editing rc.conf(5)".
|
#
1.60 |
|
26-Jul-2003 |
lukem |
Add "*,v" to the list of scratch files to skip. Suggested by Johnny Lam / Alistair Crooks
|
#
1.59 |
|
04-Jul-2003 |
lukem |
Revert previous; the "return" if rc.subr had already loaded had issues in some circumstances where run_rc_script()'s sourcing of an rc.d file which then sourced rc.subr, the `optimisation' in rc.subr to "return as we're already loaded" would finish more than just the inner-most sourcing. I haven't tracked down the exact issue, but removing the `optimisation' fixes the problem I noticed in starting up certain rc.d scripts, and may fix [bin/22053] as well.
|
#
1.58 |
|
27-Jun-2003 |
lukem |
If _rc_subr_loaded=true, "return" immediately, otherwise set that var and continue as normal. Gains ~ 2 seconds on 110 runs of ". rc.subr" on a shark. Suggested by Andrew Cagney in [bin/18400]
|
#
1.57 |
|
27-Jun-2003 |
lukem |
run_rc_command(): when checking if ${command} exists before executing it, be sure to check under ${name_chroot} (if set). Fix from Ed Ravin in [bin/18523]
|
#
1.56 |
|
03-Jun-2003 |
christos |
Use more concise shell syntax: 1. for i in $* -> for i 2. foo=$* -> foo="$@"
|
#
1.55 |
|
05-Jan-2003 |
lukem |
Fix logic error I introduced recently into mount_critical_filesystems(). Noted by kilbi@rad.rwth-aachen.de in [bin/19703].
|
#
1.54 |
|
05-Jan-2003 |
lukem |
'if ! command;' is not POSIX sh, even though our /bin/sh supports it
|
#
1.53 |
|
04-Jan-2003 |
lukem |
Change how internal boolean variables are used to: if ! ${_somevar:-false}; then _somevar=true fi (Consisent, slightly quicker, and slightly cleaner)
|
Revision tags: fvdl_fs64_base
|
#
1.52 |
|
26-Aug-2002 |
abs |
Append ' - see rc.conf(5)' to unset variable warning: /etc/rc.d/fu: WARNING: $fu is not set properly - see rc.conf(5). Add a note to rc.conf that third party packages may test for additional variables.
|
#
1.51 |
|
25-Jul-2002 |
grant |
add test for /usr/bin/logger in warn/err.
|
#
1.50 |
|
08-Jul-2002 |
atatat |
Add systrace(1) support to rc.subr. Most services (eg, ${name} is 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.
|
Revision tags: netbsd-1-6-base
|
#
1.49 |
|
21-May-2002 |
lukem |
branches: 1.49.2; When using backup_uses_rcs=YES in backup_file(), after checking the file 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").
|
#
1.48 |
|
18-Apr-2002 |
lukem |
consistently set rc_(fast|force)=yes
|
#
1.47 |
|
27-Mar-2002 |
lukem |
Replace $critical_filesystems_beforenet with $critical_filesystems_local . 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!
|
#
1.46 |
|
22-Mar-2002 |
lukem |
- 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].
|
#
1.45 |
|
21-Mar-2002 |
lukem |
- Add run_rc_command() control variable $command_interpreter 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.
|
#
1.44 |
|
13-Mar-2002 |
lukem |
Use ${_arg}_postcmd even if we're not using the default ${_arg}_cmd method.
|
#
1.43 |
|
13-Mar-2002 |
lukem |
Implement ${_arg}_postcmd support, which is run if a default start/stop/reload/restart operation succeeds (i.e, zero exit code). Code from Lubomir Sedlacik <salo@Xtrmntr.org>.
|
#
1.42 |
|
25-Feb-2002 |
lukem |
Fixes derived from [bin/15563] submitted by Ron Roskens: - 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.
|
#
1.41 |
|
25-Feb-2002 |
lukem |
fix spelo. crank copyright year
|
#
1.40 |
|
25-Feb-2002 |
lukem |
Don't run "status" as if "force" is set, thus reverting part of rev 1.29. 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.
|
#
1.39 |
|
25-Feb-2002 |
lukem |
run_rc_script() improvements: - 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
|
#
1.38 |
|
19-Nov-2001 |
lukem |
Add reverse_list(), which prints the reverse of the list of words. Doesn't attempt to handle words with whitespace, etc.
|
#
1.37 |
|
18-Jun-2001 |
lukem |
Improve run_rc_script(): - 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].
|
#
1.36 |
|
10-May-2001 |
atatat |
When using rcs to track backups, force the rcs archive to be unlocked, use only non-strict locking, and leave the archives unlocked after checking in changes.
|
#
1.35 |
|
09-May-2001 |
lukem |
* change wait_for_pids() to spin forever (rather than just ~ 65 seconds). * 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 ?)
|
#
1.34 |
|
07-May-2001 |
lukem |
Don't try and use single quotes in the RHS of a ${ :+ } expansion 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.
|
#
1.33 |
|
18-Apr-2001 |
lukem |
* provide wait_for_pids(), which spins until all the given pids don't exist * 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.
|
#
1.32 |
|
06-Apr-2001 |
lukem |
clarify that ${name}_groups is comma separated
|
#
1.31 |
|
04-Apr-2001 |
atatat |
Provide the capability of storing backups via RCS instead of just a "current" and a "last" (which is useless if you wanna know what you changed last week). Set the default to on.
|
#
1.30 |
|
28-Feb-2001 |
lukem |
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
|
#
1.29 |
|
17-Nov-2000 |
lukem |
* always run `status'; i.e, ignore the setting of $rcvar just like `rcvar' does. * 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.
|
#
1.28 |
|
06-Nov-2000 |
lukem |
when doing `status', return non-zero if the program isn't running. request by thorpej.
|
#
1.27 |
|
05-Nov-2000 |
lukem |
when running `forcerestart', call the underlying `stop' and `start' with the `force' prefix as well
|
#
1.26 |
|
07-Oct-2000 |
lukem |
use ${foo##*/} instead of `basename $foo`. as suggested (with minor variation) by Toru Nishimura <nisimura@itc.aist-nara.ac.jp>
|
#
1.25 |
|
01-Oct-2000 |
lukem |
remove unnecessary leading `$' on warnings printed for $required_dirs and $required_files.
|
#
1.24 |
|
19-Sep-2000 |
lukem |
- only perform the checkyesno on the variable named in $rcvar (rather than 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
|
#
1.23 |
|
19-Aug-2000 |
lukem |
support ${name}_nice even when using ${name}_chroot. per discussion with mrg...
|
#
1.22 |
|
17-Aug-2000 |
lukem |
add support for ${name}_chroot, which chroot(8)s before running the command. 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 :-]
|
#
1.21 |
|
20-Jul-2000 |
lukem |
in err() and warn() put a : between the ERROR/WARNING label and the message
|
Revision tags: netbsd-1-5-base
|
#
1.20 |
|
09-Jun-2000 |
fvdl |
branches: 1.20.2; Add and rc.conf.d directory. If a config file for command X exists (/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
|
Revision tags: minoura-xpg4dl-base
|
#
1.19 |
|
13-May-2000 |
lukem |
branches: 1.19.2; Implement load_rc_config(), which takes the config name as an argument. 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/*.
|
#
1.18 |
|
13-May-2000 |
lukem |
implement three new variables for run_rc_command: - ${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 :)
|
#
1.17 |
|
30-Apr-2000 |
lukem |
- prefix some more local variables with `_' (when you have a convention, stick to it :-) - simplify run_rc_script (no need to support fast* or force* here...) - clarify some comments
|
#
1.16 |
|
30-Apr-2000 |
lukem |
change run_rc_command() to take the list of extra commands supported 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.
|
#
1.15 |
|
28-Apr-2000 |
lukem |
in check_pidfile and check_process, also match "(" + `basename prog` + ")" . noted by veego@
|
#
1.14 |
|
26-Apr-2000 |
lukem |
don't bother checking rc_configured each time run_rc_command executes; once in /etc/rc is enough
|
#
1.13 |
|
22-Apr-2000 |
lukem |
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).
|
#
1.12 |
|
19-Apr-2000 |
simonb |
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.
|
#
1.11 |
|
10-Mar-2000 |
lukem |
* add: 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
|
Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
|
#
1.10 |
|
07-Jul-1999 |
drochner |
repair diskless startup: "netstart" needs "sysctl" and "awk" now, thus "/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...
|
#
1.9 |
|
28-Apr-1999 |
nathanw |
Move the knowledge that /usr and /var should be mounted early from 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.
|
#
1.8 |
|
13-Apr-1999 |
cjs |
When checking local status, jJust ignore not-found filesystems, rather than printing an error, just as we do when we try to mount it.
|
Revision tags: netbsd-1-4-base
|
#
1.7 |
|
01-Apr-1999 |
cjs |
branches: 1.7.2; 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.
|
#
1.6 |
|
24-Mar-1999 |
mellon |
- Move critical filesystem mounting code into a shell function and put that in rc.subr. - Support critfs_require_network rc.conf variable.
|
#
1.5 |
|
28-Feb-1998 |
lukem |
improve description comment
|
#
1.4 |
|
28-Feb-1998 |
lukem |
* add synonyms for "yes": "true", "on", and "1" * add synonyms for "no": "false", "off", and "0" * remove unnecessary trailing semicolons (this is sh, not C)
|
#
1.3 |
|
26-Jan-1998 |
lukem |
convert 'if .. else .. fi' into a 'case .. esac', and allow for any uppercase/lowercase variations of 'yes' and 'no'. fixes [misc/4887] sent in by "John F. Woods" <jfw@jfwhome.funhouse.com>
|
Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
|
#
1.2 |
|
30-Aug-1997 |
cjs |
Prune unused function.
|
#
1.1 |
|
29-Aug-1997 |
cjs |
Split rc.conf variables for starting programs into two: an on/off 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.
|
#
1.109 |
|
03-Feb-2022 |
alnsn |
Compare $_mount_es with 0
|
#
1.108 |
|
03-Feb-2022 |
alnsn |
Add mount_critical_filesystems_zfs
The new function is similar to mount_critical_filesystems but it walks through ZFS datasets and mounts matching entries.
|
#
1.107 |
|
06-Nov-2021 |
christos |
Set the path unconditionally to what rc sets it to, so that when running individual scripts like 'env - /etc/rc.d/syslogd restart' programs like rcorder are found.
|
Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
|
#
1.106 |
|
20-Dec-2020 |
uwe |
run_rc_command - don't prefix the rcvar variable name with the dollar sign.
The output without the dollar sign is less confusing as it's actual valid shell syntax:
$ /etc/rc.d/foo rcvar # food food=YES
Brought up on tech-userlevel@ by Rocky Hotas with some LGTMs from other people and no objections.
We still refer to '$food' in warnings/errors though.
|
#
1.105 |
|
17-Sep-2020 |
otis |
Fix waiting for PIDs on stop.
Fix expansion of positional parameters. Also move the local variable declaration to more apropriate place.
|
Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
|
#
1.104 |
|
05-Apr-2020 |
christos |
Prevent waiting for processes to exit forever by introducing _rc_kill_ntries, which if set, will SIGKILL the processes that did not die yet.
|
Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE is-mlppp-base netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930
|
#
1.103 |
|
23-Sep-2018 |
kre |
rc.subr can be used in install images (from sysinst) so must use only POSIX specified test uses (no -a or -o). Also, use printf always, rather than echo (replace echo as a function using echo with one which uses printf).
|
Revision tags: pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
|
#
1.102 |
|
11-Apr-2018 |
christos |
branches: 1.102.2; Hide ps error about processes not found (we could be more specific...) It is superfluous, since we print: foo not running? (check /var/run/foo/foo.pid).
|
Revision tags: pgoyette-compat-0407
|
#
1.101 |
|
01-Apr-2018 |
kre |
PR misc/53145 (Bruce Lilly)
Use ps -A instead of ps -ax (-A means -ax, but -A is posix, -x is not) Use ps -o args instead of ps -o command (same reason).
This makes no difference when the ps used is /bin/ps on NetBSD, but can make a difference when some other ps command gets invoked instead.
XXX pullup -8
|
Revision tags: pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
|
#
1.100 |
|
13-Apr-2017 |
christos |
branches: 1.100.4; 1.100.10; remove env.
|
#
1.99 |
|
21-Mar-2017 |
christos |
Clear rc variables that contain state that is gone after the boot process is complete, so that scripts invoked from powerd don't think that they are still invoked by the rc system and fail. Reported by rudolf @ tech-userlevel
|
Revision tags: pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
|
#
1.98 |
|
06-Mar-2016 |
christos |
branches: 1.98.2; 1.98.4; Introduce kat() a built-in version of cat(1) that strips shell-like comments.
|
#
1.97 |
|
31-Oct-2015 |
phx |
PR misc/50046 Remove the expensive tests in _have_rc_postprocessor(), as proposed by apb@. It more than halves the multiuser boot time on slow machines and brings it back near to the previous level.
|
#
1.96 |
|
07-Oct-2014 |
roy |
sleep for 0.05 seconds instead of 2 seconds when checking if the pids are still alive for a much faster exit.
|
#
1.95 |
|
21-Sep-2014 |
roy |
Add checkyesnox function so we can test a configurable without being warned of its non-existance.
|
Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
|
#
1.94 |
|
27-Jul-2014 |
apb |
branches: 1.94.2; 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.
|
#
1.93 |
|
22-Jul-2014 |
wiz |
'file system' for consistency with documentation (instead of 'filesystem').
|
Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
|
#
1.92 |
|
17-Dec-2012 |
apb |
branches: 1.92.8; Add shell implementations of basename and dirname to rc.subr. They are supposed to mimic basename(1) and dirname(1), except that they are usable before /usr/bin is mounted.
|
Revision tags: yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
|
#
1.91 |
|
07-Apr-2012 |
christos |
branches: 1.91.2; back out change that makes onestart work, to be committed at some other time.
|
#
1.90 |
|
07-Apr-2012 |
christos |
give wedges to everyone
|
#
1.89 |
|
07-Apr-2012 |
apb |
The error message when /var is not a file system chhanged from mount: unknown special file or file system `/var' to mount: Unknown special file or file system `/var' so match them both.
|
Revision tags: netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.88 |
|
11-Aug-2011 |
apb |
branches: 1.88.2; 1.88.4; 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.
|
#
1.87 |
|
09-Jun-2011 |
christos |
PR/42642: Ed Ravin: Handle daemons that start with #!/usr/bin/env interp
|
Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.86 |
|
26-Sep-2010 |
apb |
branches: 1.86.4; Add a collapse_backslash_newline function to rc.subr.
|
#
1.85 |
|
08-Jun-2010 |
christos |
use modulo instead of logical and. from pooka
|
#
1.84 |
|
08-Jun-2010 |
christos |
explain why this code is there.
|
#
1.83 |
|
06-Jun-2010 |
christos |
fix conditional, from dholland.
|
#
1.82 |
|
04-Jun-2010 |
christos |
print human readable exit code.
|
#
1.81 |
|
15-Mar-2010 |
jmmv |
Allow the run_rc_command function in rc.subr to pass extra parameters to the command being executed. This is to allow rc.d scripts to do:
run_rc_command "${@}"
instead of:
run_rc_command "${1}"
and let the command handler (start, stop, etc.) receive the arguments after the command name.
None of the default commands allow extra arguments, and they will error out if any are given. This is mostly useful for script-specific commands that are only supposed to be used through the command line and, therefore, need to provide a friendly interface.
Proposed in tech-userlevel@. No major objections except for some minor concerns regarding whether this should be allowed or not at all. Note that I'm not touching any of the rc.d scripts in the base system, so this is effectively a no-op from the user point of view.
|
Revision tags: matt-premerge-20091211
|
#
1.80 |
|
14-Sep-2009 |
apb |
Fix some errors in the way scripts with "KEYWORD: interactive" are handled. There was an inverted test, and "set $_args" had the wrong scope (in several nearly-identical blocks of code).
|
#
1.79 |
|
14-Sep-2009 |
apb |
Add the ability for file systems mounted via mount_critical_filesystems() in rc.subr to be marked as optional. This means that it's not an error if the file system is not mentioned in /etc/fstab. It is still an error if something else goes wrong.
Change the defaults for these two variables in /etc/defaults/rc.conf: critical_filesystems_local="OPTIONAL:/var" critical_filesystems_remote="OPTIONAL:/usr"
|
#
1.78 |
|
11-Sep-2009 |
apb |
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.
|
#
1.77 |
|
05-Sep-2009 |
apb |
Change multiple spaces to tabs on one line
|
#
1.76 |
|
10-Jul-2009 |
christos |
1. centralize the fsck error handling 2. don't check if root is on nfs 3. reboot -n if root was modified as the manual page suggests
|
Revision tags: jym-xensuspend-nbase jym-xensuspend-base
|
#
1.75 |
|
28-Apr-2009 |
reed |
Get rid of extra space in Usage statement.
|
Revision tags: mjf-devfs2-base2
|
#
1.74 |
|
06-Dec-2008 |
salo |
branches: 1.74.2; A very old patch sitting in my tree..
When rc scripts are started from interactive shell, be nice and when user tries to start an unconfigured service, point him to rc.conf(5) and tell him about the one* keyword. Also be more user friendly when an unknown argument is entered.
Example:
# /etc/rc.d/cron start $cron is not enabled - see rc.conf(5). Use the following if you wish to perform the operation: /etc/rc.d/cron onestart
# /etc/rc.d/cron nonsense /etc/rc.d/cron: unknown directive 'nonsense'. Usage: /etc/rc.d/cron [fast|force|one](start stop restart rcvar status poll)
Inspired by discussion on tech-userlevel:
http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0010.html http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0011.html http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0012.html
Reminded about it and reviewed by <lukem>
|
Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 mjf-devfs2-base
|
#
1.73 |
|
23-Jun-2008 |
dholland |
branches: 1.73.2; fix typo
|
Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
|
#
1.72 |
|
22-May-2008 |
he |
Add support for optionally setting some environment variables before starting ${command}, via ${name}_env.
Discussed with lukem.
|
Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2
|
#
1.71 |
|
30-Apr-2008 |
martin |
branches: 1.71.2; Convert TNF licenses to new 2 clause variant
|
Revision tags: yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-base mjf-devfs-base matt-armv6-nbase matt-armv6-base hpcarm-cleanup-base
|
#
1.70 |
|
31-Dec-2007 |
ad |
branches: 1.70.2; 1.70.6; 1.70.8; Remove systrace. Ok core@.
|
Revision tags: matt-armv6-prevmlocking cube-autoconf-base matt-mips64-base
|
#
1.69 |
|
06-Apr-2007 |
apb |
branches: 1.69.4; * Add a stop_boot() function in rc.subr, to terminate a multi-user boot by killing the parent process. The parent's PID is saved in $RC_PID. * In all rc.d/* scripts that previously tried to stop the boot, replace in-line code with "stop_boot". * Document this.
This should fix PR 29822.
|
#
1.68 |
|
27-Jan-2007 |
hubertf |
_find_processes(): in addition to the existing "interpreter: /path/to/daemon" also recognize "interpreter: daemon" in ps(1) output.
That case statement should be rewritten with expr(1) if more flexibility is needed.
Fixes PR 35366 by Dominik Joe Pantucek, debugged with much assistance by him on IRC.
|
Revision tags: netbsd-4-base
|
#
1.67 |
|
07-Oct-2006 |
elad |
branches: 1.67.2; PR/32004: Ed Ravin: command interpreter test in rc.subr doesn't accomodate chroots
Patch applied, thanks!
okay apb@
|
Revision tags: abandoned-netbsd-4-base
|
#
1.66 |
|
01-Apr-2006 |
he |
In order to handle some perl scripts running as daemons, add a pattern which also matches "`basename $interpreter`: $command" in the ps listing. Should fix PR#31932.
|
Revision tags: netbsd-3-0-3-RELEASE netbsd-3-0-2-RELEASE netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
|
#
1.65 |
|
12-Oct-2004 |
lukem |
branches: 1.65.2; * Implement load_rc_config_var cmd var to load the rc.conf(5) configuration for cmd and set var in the current shell, using 'load_rc_config var' in a sub-shell to avoid unwanted side-effects.
* Improve required_vars warning message.
|
#
1.64 |
|
13-Aug-2004 |
mycroft |
Add an _rc_subr_loaded variable, set to ":" by rc.subr. Scripts can use this for a speedup by doing: $_rc_subr_loaded . /etc/rc.subr
|
#
1.63 |
|
03-May-2004 |
lukem |
When performing "start", "stop" or "reload" in run_rc_command(), send any "<name> already running" or "<name> not running" messages to stderr instead of stdout before the (existing) non-zero exit.
|
#
1.62 |
|
02-Apr-2004 |
jmmv |
Introduce and use the rcvar_manpage variable, which contains the manual page name where the user should look at for documentation about rcvar. It defaults to 'rc.subr(5)', as rc.subr is mainly used by rc.d scripts.
This variable is useful to let the daily, weekly, monthly and security scripts tune the warning message shown when any of the variables they handle is not properly set.
Closes PR misc/23908.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.61 |
|
06-Jan-2004 |
lukem |
branches: 1.61.4; Implement ``one'' prefix to allow a "one shot" operation as if ${rcvar}=yes yet all the other prerequisite tests are still performed. The existing ``force'' prefix is a sledgehammer that ignores all the prerequisite checks and always returns a zero exit status; this is a more gentle approach to the problem of "manipulate this disabled service without editing rc.conf(5)".
|
#
1.60 |
|
26-Jul-2003 |
lukem |
Add "*,v" to the list of scratch files to skip. Suggested by Johnny Lam / Alistair Crooks
|
#
1.59 |
|
04-Jul-2003 |
lukem |
Revert previous; the "return" if rc.subr had already loaded had issues in some circumstances where run_rc_script()'s sourcing of an rc.d file which then sourced rc.subr, the `optimisation' in rc.subr to "return as we're already loaded" would finish more than just the inner-most sourcing. I haven't tracked down the exact issue, but removing the `optimisation' fixes the problem I noticed in starting up certain rc.d scripts, and may fix [bin/22053] as well.
|
#
1.58 |
|
27-Jun-2003 |
lukem |
If _rc_subr_loaded=true, "return" immediately, otherwise set that var and continue as normal. Gains ~ 2 seconds on 110 runs of ". rc.subr" on a shark. Suggested by Andrew Cagney in [bin/18400]
|
#
1.57 |
|
27-Jun-2003 |
lukem |
run_rc_command(): when checking if ${command} exists before executing it, be sure to check under ${name_chroot} (if set). Fix from Ed Ravin in [bin/18523]
|
#
1.56 |
|
03-Jun-2003 |
christos |
Use more concise shell syntax: 1. for i in $* -> for i 2. foo=$* -> foo="$@"
|
#
1.55 |
|
05-Jan-2003 |
lukem |
Fix logic error I introduced recently into mount_critical_filesystems(). Noted by kilbi@rad.rwth-aachen.de in [bin/19703].
|
#
1.54 |
|
05-Jan-2003 |
lukem |
'if ! command;' is not POSIX sh, even though our /bin/sh supports it
|
#
1.53 |
|
04-Jan-2003 |
lukem |
Change how internal boolean variables are used to: if ! ${_somevar:-false}; then _somevar=true fi (Consisent, slightly quicker, and slightly cleaner)
|
Revision tags: fvdl_fs64_base
|
#
1.52 |
|
26-Aug-2002 |
abs |
Append ' - see rc.conf(5)' to unset variable warning: /etc/rc.d/fu: WARNING: $fu is not set properly - see rc.conf(5). Add a note to rc.conf that third party packages may test for additional variables.
|
#
1.51 |
|
25-Jul-2002 |
grant |
add test for /usr/bin/logger in warn/err.
|
#
1.50 |
|
08-Jul-2002 |
atatat |
Add systrace(1) support to rc.subr. Most services (eg, ${name} is 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.
|
Revision tags: netbsd-1-6-base
|
#
1.49 |
|
21-May-2002 |
lukem |
branches: 1.49.2; When using backup_uses_rcs=YES in backup_file(), after checking the file 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").
|
#
1.48 |
|
18-Apr-2002 |
lukem |
consistently set rc_(fast|force)=yes
|
#
1.47 |
|
27-Mar-2002 |
lukem |
Replace $critical_filesystems_beforenet with $critical_filesystems_local . 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!
|
#
1.46 |
|
22-Mar-2002 |
lukem |
- 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].
|
#
1.45 |
|
21-Mar-2002 |
lukem |
- Add run_rc_command() control variable $command_interpreter 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.
|
#
1.44 |
|
13-Mar-2002 |
lukem |
Use ${_arg}_postcmd even if we're not using the default ${_arg}_cmd method.
|
#
1.43 |
|
13-Mar-2002 |
lukem |
Implement ${_arg}_postcmd support, which is run if a default start/stop/reload/restart operation succeeds (i.e, zero exit code). Code from Lubomir Sedlacik <salo@Xtrmntr.org>.
|
#
1.42 |
|
25-Feb-2002 |
lukem |
Fixes derived from [bin/15563] submitted by Ron Roskens: - 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.
|
#
1.41 |
|
25-Feb-2002 |
lukem |
fix spelo. crank copyright year
|
#
1.40 |
|
25-Feb-2002 |
lukem |
Don't run "status" as if "force" is set, thus reverting part of rev 1.29. 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.
|
#
1.39 |
|
25-Feb-2002 |
lukem |
run_rc_script() improvements: - 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
|
#
1.38 |
|
19-Nov-2001 |
lukem |
Add reverse_list(), which prints the reverse of the list of words. Doesn't attempt to handle words with whitespace, etc.
|
#
1.37 |
|
18-Jun-2001 |
lukem |
Improve run_rc_script(): - 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].
|
#
1.36 |
|
10-May-2001 |
atatat |
When using rcs to track backups, force the rcs archive to be unlocked, use only non-strict locking, and leave the archives unlocked after checking in changes.
|
#
1.35 |
|
09-May-2001 |
lukem |
* change wait_for_pids() to spin forever (rather than just ~ 65 seconds). * 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 ?)
|
#
1.34 |
|
07-May-2001 |
lukem |
Don't try and use single quotes in the RHS of a ${ :+ } expansion 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.
|
#
1.33 |
|
18-Apr-2001 |
lukem |
* provide wait_for_pids(), which spins until all the given pids don't exist * 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.
|
#
1.32 |
|
06-Apr-2001 |
lukem |
clarify that ${name}_groups is comma separated
|
#
1.31 |
|
04-Apr-2001 |
atatat |
Provide the capability of storing backups via RCS instead of just a "current" and a "last" (which is useless if you wanna know what you changed last week). Set the default to on.
|
#
1.30 |
|
28-Feb-2001 |
lukem |
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
|
#
1.29 |
|
17-Nov-2000 |
lukem |
* always run `status'; i.e, ignore the setting of $rcvar just like `rcvar' does. * 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.
|
#
1.28 |
|
06-Nov-2000 |
lukem |
when doing `status', return non-zero if the program isn't running. request by thorpej.
|
#
1.27 |
|
05-Nov-2000 |
lukem |
when running `forcerestart', call the underlying `stop' and `start' with the `force' prefix as well
|
#
1.26 |
|
07-Oct-2000 |
lukem |
use ${foo##*/} instead of `basename $foo`. as suggested (with minor variation) by Toru Nishimura <nisimura@itc.aist-nara.ac.jp>
|
#
1.25 |
|
01-Oct-2000 |
lukem |
remove unnecessary leading `$' on warnings printed for $required_dirs and $required_files.
|
#
1.24 |
|
19-Sep-2000 |
lukem |
- only perform the checkyesno on the variable named in $rcvar (rather than 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
|
#
1.23 |
|
19-Aug-2000 |
lukem |
support ${name}_nice even when using ${name}_chroot. per discussion with mrg...
|
#
1.22 |
|
17-Aug-2000 |
lukem |
add support for ${name}_chroot, which chroot(8)s before running the command. 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 :-]
|
#
1.21 |
|
20-Jul-2000 |
lukem |
in err() and warn() put a : between the ERROR/WARNING label and the message
|
Revision tags: netbsd-1-5-base
|
#
1.20 |
|
09-Jun-2000 |
fvdl |
branches: 1.20.2; Add and rc.conf.d directory. If a config file for command X exists (/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
|
Revision tags: minoura-xpg4dl-base
|
#
1.19 |
|
13-May-2000 |
lukem |
branches: 1.19.2; Implement load_rc_config(), which takes the config name as an argument. 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/*.
|
#
1.18 |
|
13-May-2000 |
lukem |
implement three new variables for run_rc_command: - ${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 :)
|
#
1.17 |
|
30-Apr-2000 |
lukem |
- prefix some more local variables with `_' (when you have a convention, stick to it :-) - simplify run_rc_script (no need to support fast* or force* here...) - clarify some comments
|
#
1.16 |
|
30-Apr-2000 |
lukem |
change run_rc_command() to take the list of extra commands supported 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.
|
#
1.15 |
|
28-Apr-2000 |
lukem |
in check_pidfile and check_process, also match "(" + `basename prog` + ")" . noted by veego@
|
#
1.14 |
|
26-Apr-2000 |
lukem |
don't bother checking rc_configured each time run_rc_command executes; once in /etc/rc is enough
|
#
1.13 |
|
22-Apr-2000 |
lukem |
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).
|
#
1.12 |
|
19-Apr-2000 |
simonb |
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.
|
#
1.11 |
|
10-Mar-2000 |
lukem |
* add: 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
|
Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
|
#
1.10 |
|
07-Jul-1999 |
drochner |
repair diskless startup: "netstart" needs "sysctl" and "awk" now, thus "/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...
|
#
1.9 |
|
28-Apr-1999 |
nathanw |
Move the knowledge that /usr and /var should be mounted early from 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.
|
#
1.8 |
|
13-Apr-1999 |
cjs |
When checking local status, jJust ignore not-found filesystems, rather than printing an error, just as we do when we try to mount it.
|
Revision tags: netbsd-1-4-base
|
#
1.7 |
|
01-Apr-1999 |
cjs |
branches: 1.7.2; 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.
|
#
1.6 |
|
24-Mar-1999 |
mellon |
- Move critical filesystem mounting code into a shell function and put that in rc.subr. - Support critfs_require_network rc.conf variable.
|
#
1.5 |
|
28-Feb-1998 |
lukem |
improve description comment
|
#
1.4 |
|
28-Feb-1998 |
lukem |
* add synonyms for "yes": "true", "on", and "1" * add synonyms for "no": "false", "off", and "0" * remove unnecessary trailing semicolons (this is sh, not C)
|
#
1.3 |
|
26-Jan-1998 |
lukem |
convert 'if .. else .. fi' into a 'case .. esac', and allow for any uppercase/lowercase variations of 'yes' and 'no'. fixes [misc/4887] sent in by "John F. Woods" <jfw@jfwhome.funhouse.com>
|
Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
|
#
1.2 |
|
30-Aug-1997 |
cjs |
Prune unused function.
|
#
1.1 |
|
29-Aug-1997 |
cjs |
Split rc.conf variables for starting programs into two: an on/off 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.
|
#
1.107 |
|
06-Nov-2021 |
christos |
Set the path unconditionally to what rc sets it to, so that when running individual scripts like 'env - /etc/rc.d/syslogd restart' programs like rcorder are found.
|
Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
|
#
1.106 |
|
20-Dec-2020 |
uwe |
run_rc_command - don't prefix the rcvar variable name with the dollar sign.
The output without the dollar sign is less confusing as it's actual valid shell syntax:
$ /etc/rc.d/foo rcvar # food food=YES
Brought up on tech-userlevel@ by Rocky Hotas with some LGTMs from other people and no objections.
We still refer to '$food' in warnings/errors though.
|
#
1.105 |
|
17-Sep-2020 |
otis |
Fix waiting for PIDs on stop.
Fix expansion of positional parameters. Also move the local variable declaration to more apropriate place.
|
Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
|
#
1.104 |
|
05-Apr-2020 |
christos |
Prevent waiting for processes to exit forever by introducing _rc_kill_ntries, which if set, will SIGKILL the processes that did not die yet.
|
Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE is-mlppp-base netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930
|
#
1.103 |
|
23-Sep-2018 |
kre |
rc.subr can be used in install images (from sysinst) so must use only POSIX specified test uses (no -a or -o). Also, use printf always, rather than echo (replace echo as a function using echo with one which uses printf).
|
Revision tags: pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
|
#
1.102 |
|
11-Apr-2018 |
christos |
branches: 1.102.2; Hide ps error about processes not found (we could be more specific...) It is superfluous, since we print: foo not running? (check /var/run/foo/foo.pid).
|
Revision tags: pgoyette-compat-0407
|
#
1.101 |
|
01-Apr-2018 |
kre |
PR misc/53145 (Bruce Lilly)
Use ps -A instead of ps -ax (-A means -ax, but -A is posix, -x is not) Use ps -o args instead of ps -o command (same reason).
This makes no difference when the ps used is /bin/ps on NetBSD, but can make a difference when some other ps command gets invoked instead.
XXX pullup -8
|
Revision tags: pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
|
#
1.100 |
|
13-Apr-2017 |
christos |
branches: 1.100.4; 1.100.10; remove env.
|
#
1.99 |
|
21-Mar-2017 |
christos |
Clear rc variables that contain state that is gone after the boot process is complete, so that scripts invoked from powerd don't think that they are still invoked by the rc system and fail. Reported by rudolf @ tech-userlevel
|
Revision tags: pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
|
#
1.98 |
|
06-Mar-2016 |
christos |
branches: 1.98.2; 1.98.4; Introduce kat() a built-in version of cat(1) that strips shell-like comments.
|
#
1.97 |
|
31-Oct-2015 |
phx |
PR misc/50046 Remove the expensive tests in _have_rc_postprocessor(), as proposed by apb@. It more than halves the multiuser boot time on slow machines and brings it back near to the previous level.
|
#
1.96 |
|
07-Oct-2014 |
roy |
sleep for 0.05 seconds instead of 2 seconds when checking if the pids are still alive for a much faster exit.
|
#
1.95 |
|
21-Sep-2014 |
roy |
Add checkyesnox function so we can test a configurable without being warned of its non-existance.
|
Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
|
#
1.94 |
|
27-Jul-2014 |
apb |
branches: 1.94.2; 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.
|
#
1.93 |
|
22-Jul-2014 |
wiz |
'file system' for consistency with documentation (instead of 'filesystem').
|
Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
|
#
1.92 |
|
17-Dec-2012 |
apb |
branches: 1.92.8; Add shell implementations of basename and dirname to rc.subr. They are supposed to mimic basename(1) and dirname(1), except that they are usable before /usr/bin is mounted.
|
Revision tags: yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
|
#
1.91 |
|
07-Apr-2012 |
christos |
branches: 1.91.2; back out change that makes onestart work, to be committed at some other time.
|
#
1.90 |
|
07-Apr-2012 |
christos |
give wedges to everyone
|
#
1.89 |
|
07-Apr-2012 |
apb |
The error message when /var is not a file system chhanged from mount: unknown special file or file system `/var' to mount: Unknown special file or file system `/var' so match them both.
|
Revision tags: netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.88 |
|
11-Aug-2011 |
apb |
branches: 1.88.2; 1.88.4; 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.
|
#
1.87 |
|
09-Jun-2011 |
christos |
PR/42642: Ed Ravin: Handle daemons that start with #!/usr/bin/env interp
|
Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.86 |
|
26-Sep-2010 |
apb |
branches: 1.86.4; Add a collapse_backslash_newline function to rc.subr.
|
#
1.85 |
|
08-Jun-2010 |
christos |
use modulo instead of logical and. from pooka
|
#
1.84 |
|
08-Jun-2010 |
christos |
explain why this code is there.
|
#
1.83 |
|
06-Jun-2010 |
christos |
fix conditional, from dholland.
|
#
1.82 |
|
04-Jun-2010 |
christos |
print human readable exit code.
|
#
1.81 |
|
15-Mar-2010 |
jmmv |
Allow the run_rc_command function in rc.subr to pass extra parameters to the command being executed. This is to allow rc.d scripts to do:
run_rc_command "${@}"
instead of:
run_rc_command "${1}"
and let the command handler (start, stop, etc.) receive the arguments after the command name.
None of the default commands allow extra arguments, and they will error out if any are given. This is mostly useful for script-specific commands that are only supposed to be used through the command line and, therefore, need to provide a friendly interface.
Proposed in tech-userlevel@. No major objections except for some minor concerns regarding whether this should be allowed or not at all. Note that I'm not touching any of the rc.d scripts in the base system, so this is effectively a no-op from the user point of view.
|
Revision tags: matt-premerge-20091211
|
#
1.80 |
|
14-Sep-2009 |
apb |
Fix some errors in the way scripts with "KEYWORD: interactive" are handled. There was an inverted test, and "set $_args" had the wrong scope (in several nearly-identical blocks of code).
|
#
1.79 |
|
14-Sep-2009 |
apb |
Add the ability for file systems mounted via mount_critical_filesystems() in rc.subr to be marked as optional. This means that it's not an error if the file system is not mentioned in /etc/fstab. It is still an error if something else goes wrong.
Change the defaults for these two variables in /etc/defaults/rc.conf: critical_filesystems_local="OPTIONAL:/var" critical_filesystems_remote="OPTIONAL:/usr"
|
#
1.78 |
|
11-Sep-2009 |
apb |
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.
|
#
1.77 |
|
05-Sep-2009 |
apb |
Change multiple spaces to tabs on one line
|
#
1.76 |
|
10-Jul-2009 |
christos |
1. centralize the fsck error handling 2. don't check if root is on nfs 3. reboot -n if root was modified as the manual page suggests
|
Revision tags: jym-xensuspend-nbase jym-xensuspend-base
|
#
1.75 |
|
28-Apr-2009 |
reed |
Get rid of extra space in Usage statement.
|
Revision tags: mjf-devfs2-base2
|
#
1.74 |
|
06-Dec-2008 |
salo |
branches: 1.74.2; A very old patch sitting in my tree..
When rc scripts are started from interactive shell, be nice and when user tries to start an unconfigured service, point him to rc.conf(5) and tell him about the one* keyword. Also be more user friendly when an unknown argument is entered.
Example:
# /etc/rc.d/cron start $cron is not enabled - see rc.conf(5). Use the following if you wish to perform the operation: /etc/rc.d/cron onestart
# /etc/rc.d/cron nonsense /etc/rc.d/cron: unknown directive 'nonsense'. Usage: /etc/rc.d/cron [fast|force|one](start stop restart rcvar status poll)
Inspired by discussion on tech-userlevel:
http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0010.html http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0011.html http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0012.html
Reminded about it and reviewed by <lukem>
|
Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 mjf-devfs2-base
|
#
1.73 |
|
23-Jun-2008 |
dholland |
branches: 1.73.2; fix typo
|
Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
|
#
1.72 |
|
22-May-2008 |
he |
Add support for optionally setting some environment variables before starting ${command}, via ${name}_env.
Discussed with lukem.
|
Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2
|
#
1.71 |
|
30-Apr-2008 |
martin |
branches: 1.71.2; Convert TNF licenses to new 2 clause variant
|
Revision tags: yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-base mjf-devfs-base matt-armv6-nbase matt-armv6-base hpcarm-cleanup-base
|
#
1.70 |
|
31-Dec-2007 |
ad |
branches: 1.70.2; 1.70.6; 1.70.8; Remove systrace. Ok core@.
|
Revision tags: matt-armv6-prevmlocking cube-autoconf-base matt-mips64-base
|
#
1.69 |
|
06-Apr-2007 |
apb |
branches: 1.69.4; * Add a stop_boot() function in rc.subr, to terminate a multi-user boot by killing the parent process. The parent's PID is saved in $RC_PID. * In all rc.d/* scripts that previously tried to stop the boot, replace in-line code with "stop_boot". * Document this.
This should fix PR 29822.
|
#
1.68 |
|
27-Jan-2007 |
hubertf |
_find_processes(): in addition to the existing "interpreter: /path/to/daemon" also recognize "interpreter: daemon" in ps(1) output.
That case statement should be rewritten with expr(1) if more flexibility is needed.
Fixes PR 35366 by Dominik Joe Pantucek, debugged with much assistance by him on IRC.
|
Revision tags: netbsd-4-base
|
#
1.67 |
|
07-Oct-2006 |
elad |
branches: 1.67.2; PR/32004: Ed Ravin: command interpreter test in rc.subr doesn't accomodate chroots
Patch applied, thanks!
okay apb@
|
Revision tags: abandoned-netbsd-4-base
|
#
1.66 |
|
01-Apr-2006 |
he |
In order to handle some perl scripts running as daemons, add a pattern which also matches "`basename $interpreter`: $command" in the ps listing. Should fix PR#31932.
|
Revision tags: netbsd-3-0-3-RELEASE netbsd-3-0-2-RELEASE netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
|
#
1.65 |
|
12-Oct-2004 |
lukem |
branches: 1.65.2; * Implement load_rc_config_var cmd var to load the rc.conf(5) configuration for cmd and set var in the current shell, using 'load_rc_config var' in a sub-shell to avoid unwanted side-effects.
* Improve required_vars warning message.
|
#
1.64 |
|
13-Aug-2004 |
mycroft |
Add an _rc_subr_loaded variable, set to ":" by rc.subr. Scripts can use this for a speedup by doing: $_rc_subr_loaded . /etc/rc.subr
|
#
1.63 |
|
03-May-2004 |
lukem |
When performing "start", "stop" or "reload" in run_rc_command(), send any "<name> already running" or "<name> not running" messages to stderr instead of stdout before the (existing) non-zero exit.
|
#
1.62 |
|
02-Apr-2004 |
jmmv |
Introduce and use the rcvar_manpage variable, which contains the manual page name where the user should look at for documentation about rcvar. It defaults to 'rc.subr(5)', as rc.subr is mainly used by rc.d scripts.
This variable is useful to let the daily, weekly, monthly and security scripts tune the warning message shown when any of the variables they handle is not properly set.
Closes PR misc/23908.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.61 |
|
06-Jan-2004 |
lukem |
branches: 1.61.4; Implement ``one'' prefix to allow a "one shot" operation as if ${rcvar}=yes yet all the other prerequisite tests are still performed. The existing ``force'' prefix is a sledgehammer that ignores all the prerequisite checks and always returns a zero exit status; this is a more gentle approach to the problem of "manipulate this disabled service without editing rc.conf(5)".
|
#
1.60 |
|
26-Jul-2003 |
lukem |
Add "*,v" to the list of scratch files to skip. Suggested by Johnny Lam / Alistair Crooks
|
#
1.59 |
|
04-Jul-2003 |
lukem |
Revert previous; the "return" if rc.subr had already loaded had issues in some circumstances where run_rc_script()'s sourcing of an rc.d file which then sourced rc.subr, the `optimisation' in rc.subr to "return as we're already loaded" would finish more than just the inner-most sourcing. I haven't tracked down the exact issue, but removing the `optimisation' fixes the problem I noticed in starting up certain rc.d scripts, and may fix [bin/22053] as well.
|
#
1.58 |
|
27-Jun-2003 |
lukem |
If _rc_subr_loaded=true, "return" immediately, otherwise set that var and continue as normal. Gains ~ 2 seconds on 110 runs of ". rc.subr" on a shark. Suggested by Andrew Cagney in [bin/18400]
|
#
1.57 |
|
27-Jun-2003 |
lukem |
run_rc_command(): when checking if ${command} exists before executing it, be sure to check under ${name_chroot} (if set). Fix from Ed Ravin in [bin/18523]
|
#
1.56 |
|
03-Jun-2003 |
christos |
Use more concise shell syntax: 1. for i in $* -> for i 2. foo=$* -> foo="$@"
|
#
1.55 |
|
05-Jan-2003 |
lukem |
Fix logic error I introduced recently into mount_critical_filesystems(). Noted by kilbi@rad.rwth-aachen.de in [bin/19703].
|
#
1.54 |
|
05-Jan-2003 |
lukem |
'if ! command;' is not POSIX sh, even though our /bin/sh supports it
|
#
1.53 |
|
04-Jan-2003 |
lukem |
Change how internal boolean variables are used to: if ! ${_somevar:-false}; then _somevar=true fi (Consisent, slightly quicker, and slightly cleaner)
|
Revision tags: fvdl_fs64_base
|
#
1.52 |
|
26-Aug-2002 |
abs |
Append ' - see rc.conf(5)' to unset variable warning: /etc/rc.d/fu: WARNING: $fu is not set properly - see rc.conf(5). Add a note to rc.conf that third party packages may test for additional variables.
|
#
1.51 |
|
25-Jul-2002 |
grant |
add test for /usr/bin/logger in warn/err.
|
#
1.50 |
|
08-Jul-2002 |
atatat |
Add systrace(1) support to rc.subr. Most services (eg, ${name} is 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.
|
Revision tags: netbsd-1-6-base
|
#
1.49 |
|
21-May-2002 |
lukem |
branches: 1.49.2; When using backup_uses_rcs=YES in backup_file(), after checking the file 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").
|
#
1.48 |
|
18-Apr-2002 |
lukem |
consistently set rc_(fast|force)=yes
|
#
1.47 |
|
27-Mar-2002 |
lukem |
Replace $critical_filesystems_beforenet with $critical_filesystems_local . 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!
|
#
1.46 |
|
22-Mar-2002 |
lukem |
- 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].
|
#
1.45 |
|
21-Mar-2002 |
lukem |
- Add run_rc_command() control variable $command_interpreter 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.
|
#
1.44 |
|
13-Mar-2002 |
lukem |
Use ${_arg}_postcmd even if we're not using the default ${_arg}_cmd method.
|
#
1.43 |
|
13-Mar-2002 |
lukem |
Implement ${_arg}_postcmd support, which is run if a default start/stop/reload/restart operation succeeds (i.e, zero exit code). Code from Lubomir Sedlacik <salo@Xtrmntr.org>.
|
#
1.42 |
|
25-Feb-2002 |
lukem |
Fixes derived from [bin/15563] submitted by Ron Roskens: - 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.
|
#
1.41 |
|
25-Feb-2002 |
lukem |
fix spelo. crank copyright year
|
#
1.40 |
|
25-Feb-2002 |
lukem |
Don't run "status" as if "force" is set, thus reverting part of rev 1.29. 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.
|
#
1.39 |
|
25-Feb-2002 |
lukem |
run_rc_script() improvements: - 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
|
#
1.38 |
|
19-Nov-2001 |
lukem |
Add reverse_list(), which prints the reverse of the list of words. Doesn't attempt to handle words with whitespace, etc.
|
#
1.37 |
|
18-Jun-2001 |
lukem |
Improve run_rc_script(): - 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].
|
#
1.36 |
|
10-May-2001 |
atatat |
When using rcs to track backups, force the rcs archive to be unlocked, use only non-strict locking, and leave the archives unlocked after checking in changes.
|
#
1.35 |
|
09-May-2001 |
lukem |
* change wait_for_pids() to spin forever (rather than just ~ 65 seconds). * 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 ?)
|
#
1.34 |
|
07-May-2001 |
lukem |
Don't try and use single quotes in the RHS of a ${ :+ } expansion 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.
|
#
1.33 |
|
18-Apr-2001 |
lukem |
* provide wait_for_pids(), which spins until all the given pids don't exist * 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.
|
#
1.32 |
|
06-Apr-2001 |
lukem |
clarify that ${name}_groups is comma separated
|
#
1.31 |
|
04-Apr-2001 |
atatat |
Provide the capability of storing backups via RCS instead of just a "current" and a "last" (which is useless if you wanna know what you changed last week). Set the default to on.
|
#
1.30 |
|
28-Feb-2001 |
lukem |
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
|
#
1.29 |
|
17-Nov-2000 |
lukem |
* always run `status'; i.e, ignore the setting of $rcvar just like `rcvar' does. * 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.
|
#
1.28 |
|
06-Nov-2000 |
lukem |
when doing `status', return non-zero if the program isn't running. request by thorpej.
|
#
1.27 |
|
05-Nov-2000 |
lukem |
when running `forcerestart', call the underlying `stop' and `start' with the `force' prefix as well
|
#
1.26 |
|
07-Oct-2000 |
lukem |
use ${foo##*/} instead of `basename $foo`. as suggested (with minor variation) by Toru Nishimura <nisimura@itc.aist-nara.ac.jp>
|
#
1.25 |
|
01-Oct-2000 |
lukem |
remove unnecessary leading `$' on warnings printed for $required_dirs and $required_files.
|
#
1.24 |
|
19-Sep-2000 |
lukem |
- only perform the checkyesno on the variable named in $rcvar (rather than 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
|
#
1.23 |
|
19-Aug-2000 |
lukem |
support ${name}_nice even when using ${name}_chroot. per discussion with mrg...
|
#
1.22 |
|
17-Aug-2000 |
lukem |
add support for ${name}_chroot, which chroot(8)s before running the command. 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 :-]
|
#
1.21 |
|
20-Jul-2000 |
lukem |
in err() and warn() put a : between the ERROR/WARNING label and the message
|
Revision tags: netbsd-1-5-base
|
#
1.20 |
|
09-Jun-2000 |
fvdl |
branches: 1.20.2; Add and rc.conf.d directory. If a config file for command X exists (/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
|
Revision tags: minoura-xpg4dl-base
|
#
1.19 |
|
13-May-2000 |
lukem |
branches: 1.19.2; Implement load_rc_config(), which takes the config name as an argument. 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/*.
|
#
1.18 |
|
13-May-2000 |
lukem |
implement three new variables for run_rc_command: - ${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 :)
|
#
1.17 |
|
30-Apr-2000 |
lukem |
- prefix some more local variables with `_' (when you have a convention, stick to it :-) - simplify run_rc_script (no need to support fast* or force* here...) - clarify some comments
|
#
1.16 |
|
30-Apr-2000 |
lukem |
change run_rc_command() to take the list of extra commands supported 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.
|
#
1.15 |
|
28-Apr-2000 |
lukem |
in check_pidfile and check_process, also match "(" + `basename prog` + ")" . noted by veego@
|
#
1.14 |
|
26-Apr-2000 |
lukem |
don't bother checking rc_configured each time run_rc_command executes; once in /etc/rc is enough
|
#
1.13 |
|
22-Apr-2000 |
lukem |
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).
|
#
1.12 |
|
19-Apr-2000 |
simonb |
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.
|
#
1.11 |
|
10-Mar-2000 |
lukem |
* add: 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
|
Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
|
#
1.10 |
|
07-Jul-1999 |
drochner |
repair diskless startup: "netstart" needs "sysctl" and "awk" now, thus "/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...
|
#
1.9 |
|
28-Apr-1999 |
nathanw |
Move the knowledge that /usr and /var should be mounted early from 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.
|
#
1.8 |
|
13-Apr-1999 |
cjs |
When checking local status, jJust ignore not-found filesystems, rather than printing an error, just as we do when we try to mount it.
|
Revision tags: netbsd-1-4-base
|
#
1.7 |
|
01-Apr-1999 |
cjs |
branches: 1.7.2; 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.
|
#
1.6 |
|
24-Mar-1999 |
mellon |
- Move critical filesystem mounting code into a shell function and put that in rc.subr. - Support critfs_require_network rc.conf variable.
|
#
1.5 |
|
28-Feb-1998 |
lukem |
improve description comment
|
#
1.4 |
|
28-Feb-1998 |
lukem |
* add synonyms for "yes": "true", "on", and "1" * add synonyms for "no": "false", "off", and "0" * remove unnecessary trailing semicolons (this is sh, not C)
|
#
1.3 |
|
26-Jan-1998 |
lukem |
convert 'if .. else .. fi' into a 'case .. esac', and allow for any uppercase/lowercase variations of 'yes' and 'no'. fixes [misc/4887] sent in by "John F. Woods" <jfw@jfwhome.funhouse.com>
|
Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
|
#
1.2 |
|
30-Aug-1997 |
cjs |
Prune unused function.
|
#
1.1 |
|
29-Aug-1997 |
cjs |
Split rc.conf variables for starting programs into two: an on/off 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.
|
#
1.106 |
|
20-Dec-2020 |
uwe |
run_rc_command - don't prefix the rcvar variable name with the dollar sign.
The output without the dollar sign is less confusing as it's actual valid shell syntax:
$ /etc/rc.d/foo rcvar # food food=YES
Brought up on tech-userlevel@ by Rocky Hotas with some LGTMs from other people and no objections.
We still refer to '$food' in warnings/errors though.
|
#
1.105 |
|
17-Sep-2020 |
otis |
Fix waiting for PIDs on stop.
Fix expansion of positional parameters. Also move the local variable declaration to more apropriate place.
|
Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
|
#
1.104 |
|
05-Apr-2020 |
christos |
Prevent waiting for processes to exit forever by introducing _rc_kill_ntries, which if set, will SIGKILL the processes that did not die yet.
|
Revision tags: netbsd-9-1-RELEASE is-mlppp-base netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930
|
#
1.103 |
|
23-Sep-2018 |
kre |
rc.subr can be used in install images (from sysinst) so must use only POSIX specified test uses (no -a or -o). Also, use printf always, rather than echo (replace echo as a function using echo with one which uses printf).
|
Revision tags: pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
|
#
1.102 |
|
11-Apr-2018 |
christos |
branches: 1.102.2; Hide ps error about processes not found (we could be more specific...) It is superfluous, since we print: foo not running? (check /var/run/foo/foo.pid).
|
Revision tags: pgoyette-compat-0407
|
#
1.101 |
|
01-Apr-2018 |
kre |
PR misc/53145 (Bruce Lilly)
Use ps -A instead of ps -ax (-A means -ax, but -A is posix, -x is not) Use ps -o args instead of ps -o command (same reason).
This makes no difference when the ps used is /bin/ps on NetBSD, but can make a difference when some other ps command gets invoked instead.
XXX pullup -8
|
Revision tags: pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
|
#
1.100 |
|
13-Apr-2017 |
christos |
branches: 1.100.4; 1.100.10; remove env.
|
#
1.99 |
|
21-Mar-2017 |
christos |
Clear rc variables that contain state that is gone after the boot process is complete, so that scripts invoked from powerd don't think that they are still invoked by the rc system and fail. Reported by rudolf @ tech-userlevel
|
Revision tags: pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
|
#
1.98 |
|
06-Mar-2016 |
christos |
branches: 1.98.2; 1.98.4; Introduce kat() a built-in version of cat(1) that strips shell-like comments.
|
#
1.97 |
|
31-Oct-2015 |
phx |
PR misc/50046 Remove the expensive tests in _have_rc_postprocessor(), as proposed by apb@. It more than halves the multiuser boot time on slow machines and brings it back near to the previous level.
|
#
1.96 |
|
07-Oct-2014 |
roy |
sleep for 0.05 seconds instead of 2 seconds when checking if the pids are still alive for a much faster exit.
|
#
1.95 |
|
21-Sep-2014 |
roy |
Add checkyesnox function so we can test a configurable without being warned of its non-existance.
|
Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
|
#
1.94 |
|
27-Jul-2014 |
apb |
branches: 1.94.2; 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.
|
#
1.93 |
|
22-Jul-2014 |
wiz |
'file system' for consistency with documentation (instead of 'filesystem').
|
Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
|
#
1.92 |
|
17-Dec-2012 |
apb |
branches: 1.92.8; Add shell implementations of basename and dirname to rc.subr. They are supposed to mimic basename(1) and dirname(1), except that they are usable before /usr/bin is mounted.
|
Revision tags: yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
|
#
1.91 |
|
07-Apr-2012 |
christos |
branches: 1.91.2; back out change that makes onestart work, to be committed at some other time.
|
#
1.90 |
|
07-Apr-2012 |
christos |
give wedges to everyone
|
#
1.89 |
|
07-Apr-2012 |
apb |
The error message when /var is not a file system chhanged from mount: unknown special file or file system `/var' to mount: Unknown special file or file system `/var' so match them both.
|
Revision tags: netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.88 |
|
11-Aug-2011 |
apb |
branches: 1.88.2; 1.88.4; 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.
|
#
1.87 |
|
09-Jun-2011 |
christos |
PR/42642: Ed Ravin: Handle daemons that start with #!/usr/bin/env interp
|
Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.86 |
|
26-Sep-2010 |
apb |
branches: 1.86.4; Add a collapse_backslash_newline function to rc.subr.
|
#
1.85 |
|
08-Jun-2010 |
christos |
use modulo instead of logical and. from pooka
|
#
1.84 |
|
08-Jun-2010 |
christos |
explain why this code is there.
|
#
1.83 |
|
06-Jun-2010 |
christos |
fix conditional, from dholland.
|
#
1.82 |
|
04-Jun-2010 |
christos |
print human readable exit code.
|
#
1.81 |
|
15-Mar-2010 |
jmmv |
Allow the run_rc_command function in rc.subr to pass extra parameters to the command being executed. This is to allow rc.d scripts to do:
run_rc_command "${@}"
instead of:
run_rc_command "${1}"
and let the command handler (start, stop, etc.) receive the arguments after the command name.
None of the default commands allow extra arguments, and they will error out if any are given. This is mostly useful for script-specific commands that are only supposed to be used through the command line and, therefore, need to provide a friendly interface.
Proposed in tech-userlevel@. No major objections except for some minor concerns regarding whether this should be allowed or not at all. Note that I'm not touching any of the rc.d scripts in the base system, so this is effectively a no-op from the user point of view.
|
Revision tags: matt-premerge-20091211
|
#
1.80 |
|
14-Sep-2009 |
apb |
Fix some errors in the way scripts with "KEYWORD: interactive" are handled. There was an inverted test, and "set $_args" had the wrong scope (in several nearly-identical blocks of code).
|
#
1.79 |
|
14-Sep-2009 |
apb |
Add the ability for file systems mounted via mount_critical_filesystems() in rc.subr to be marked as optional. This means that it's not an error if the file system is not mentioned in /etc/fstab. It is still an error if something else goes wrong.
Change the defaults for these two variables in /etc/defaults/rc.conf: critical_filesystems_local="OPTIONAL:/var" critical_filesystems_remote="OPTIONAL:/usr"
|
#
1.78 |
|
11-Sep-2009 |
apb |
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.
|
#
1.77 |
|
05-Sep-2009 |
apb |
Change multiple spaces to tabs on one line
|
#
1.76 |
|
10-Jul-2009 |
christos |
1. centralize the fsck error handling 2. don't check if root is on nfs 3. reboot -n if root was modified as the manual page suggests
|
Revision tags: jym-xensuspend-nbase jym-xensuspend-base
|
#
1.75 |
|
28-Apr-2009 |
reed |
Get rid of extra space in Usage statement.
|
Revision tags: mjf-devfs2-base2
|
#
1.74 |
|
06-Dec-2008 |
salo |
branches: 1.74.2; A very old patch sitting in my tree..
When rc scripts are started from interactive shell, be nice and when user tries to start an unconfigured service, point him to rc.conf(5) and tell him about the one* keyword. Also be more user friendly when an unknown argument is entered.
Example:
# /etc/rc.d/cron start $cron is not enabled - see rc.conf(5). Use the following if you wish to perform the operation: /etc/rc.d/cron onestart
# /etc/rc.d/cron nonsense /etc/rc.d/cron: unknown directive 'nonsense'. Usage: /etc/rc.d/cron [fast|force|one](start stop restart rcvar status poll)
Inspired by discussion on tech-userlevel:
http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0010.html http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0011.html http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0012.html
Reminded about it and reviewed by <lukem>
|
Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 mjf-devfs2-base
|
#
1.73 |
|
23-Jun-2008 |
dholland |
branches: 1.73.2; fix typo
|
Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
|
#
1.72 |
|
22-May-2008 |
he |
Add support for optionally setting some environment variables before starting ${command}, via ${name}_env.
Discussed with lukem.
|
Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2
|
#
1.71 |
|
30-Apr-2008 |
martin |
branches: 1.71.2; Convert TNF licenses to new 2 clause variant
|
Revision tags: yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-base mjf-devfs-base matt-armv6-nbase matt-armv6-base hpcarm-cleanup-base
|
#
1.70 |
|
31-Dec-2007 |
ad |
branches: 1.70.2; 1.70.6; 1.70.8; Remove systrace. Ok core@.
|
Revision tags: matt-armv6-prevmlocking cube-autoconf-base matt-mips64-base
|
#
1.69 |
|
06-Apr-2007 |
apb |
branches: 1.69.4; * Add a stop_boot() function in rc.subr, to terminate a multi-user boot by killing the parent process. The parent's PID is saved in $RC_PID. * In all rc.d/* scripts that previously tried to stop the boot, replace in-line code with "stop_boot". * Document this.
This should fix PR 29822.
|
#
1.68 |
|
27-Jan-2007 |
hubertf |
_find_processes(): in addition to the existing "interpreter: /path/to/daemon" also recognize "interpreter: daemon" in ps(1) output.
That case statement should be rewritten with expr(1) if more flexibility is needed.
Fixes PR 35366 by Dominik Joe Pantucek, debugged with much assistance by him on IRC.
|
Revision tags: netbsd-4-base
|
#
1.67 |
|
07-Oct-2006 |
elad |
branches: 1.67.2; PR/32004: Ed Ravin: command interpreter test in rc.subr doesn't accomodate chroots
Patch applied, thanks!
okay apb@
|
Revision tags: abandoned-netbsd-4-base
|
#
1.66 |
|
01-Apr-2006 |
he |
In order to handle some perl scripts running as daemons, add a pattern which also matches "`basename $interpreter`: $command" in the ps listing. Should fix PR#31932.
|
Revision tags: netbsd-3-0-3-RELEASE netbsd-3-0-2-RELEASE netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
|
#
1.65 |
|
12-Oct-2004 |
lukem |
branches: 1.65.2; * Implement load_rc_config_var cmd var to load the rc.conf(5) configuration for cmd and set var in the current shell, using 'load_rc_config var' in a sub-shell to avoid unwanted side-effects.
* Improve required_vars warning message.
|
#
1.64 |
|
13-Aug-2004 |
mycroft |
Add an _rc_subr_loaded variable, set to ":" by rc.subr. Scripts can use this for a speedup by doing: $_rc_subr_loaded . /etc/rc.subr
|
#
1.63 |
|
03-May-2004 |
lukem |
When performing "start", "stop" or "reload" in run_rc_command(), send any "<name> already running" or "<name> not running" messages to stderr instead of stdout before the (existing) non-zero exit.
|
#
1.62 |
|
02-Apr-2004 |
jmmv |
Introduce and use the rcvar_manpage variable, which contains the manual page name where the user should look at for documentation about rcvar. It defaults to 'rc.subr(5)', as rc.subr is mainly used by rc.d scripts.
This variable is useful to let the daily, weekly, monthly and security scripts tune the warning message shown when any of the variables they handle is not properly set.
Closes PR misc/23908.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.61 |
|
06-Jan-2004 |
lukem |
branches: 1.61.4; Implement ``one'' prefix to allow a "one shot" operation as if ${rcvar}=yes yet all the other prerequisite tests are still performed. The existing ``force'' prefix is a sledgehammer that ignores all the prerequisite checks and always returns a zero exit status; this is a more gentle approach to the problem of "manipulate this disabled service without editing rc.conf(5)".
|
#
1.60 |
|
26-Jul-2003 |
lukem |
Add "*,v" to the list of scratch files to skip. Suggested by Johnny Lam / Alistair Crooks
|
#
1.59 |
|
04-Jul-2003 |
lukem |
Revert previous; the "return" if rc.subr had already loaded had issues in some circumstances where run_rc_script()'s sourcing of an rc.d file which then sourced rc.subr, the `optimisation' in rc.subr to "return as we're already loaded" would finish more than just the inner-most sourcing. I haven't tracked down the exact issue, but removing the `optimisation' fixes the problem I noticed in starting up certain rc.d scripts, and may fix [bin/22053] as well.
|
#
1.58 |
|
27-Jun-2003 |
lukem |
If _rc_subr_loaded=true, "return" immediately, otherwise set that var and continue as normal. Gains ~ 2 seconds on 110 runs of ". rc.subr" on a shark. Suggested by Andrew Cagney in [bin/18400]
|
#
1.57 |
|
27-Jun-2003 |
lukem |
run_rc_command(): when checking if ${command} exists before executing it, be sure to check under ${name_chroot} (if set). Fix from Ed Ravin in [bin/18523]
|
#
1.56 |
|
03-Jun-2003 |
christos |
Use more concise shell syntax: 1. for i in $* -> for i 2. foo=$* -> foo="$@"
|
#
1.55 |
|
05-Jan-2003 |
lukem |
Fix logic error I introduced recently into mount_critical_filesystems(). Noted by kilbi@rad.rwth-aachen.de in [bin/19703].
|
#
1.54 |
|
05-Jan-2003 |
lukem |
'if ! command;' is not POSIX sh, even though our /bin/sh supports it
|
#
1.53 |
|
04-Jan-2003 |
lukem |
Change how internal boolean variables are used to: if ! ${_somevar:-false}; then _somevar=true fi (Consisent, slightly quicker, and slightly cleaner)
|
Revision tags: fvdl_fs64_base
|
#
1.52 |
|
26-Aug-2002 |
abs |
Append ' - see rc.conf(5)' to unset variable warning: /etc/rc.d/fu: WARNING: $fu is not set properly - see rc.conf(5). Add a note to rc.conf that third party packages may test for additional variables.
|
#
1.51 |
|
25-Jul-2002 |
grant |
add test for /usr/bin/logger in warn/err.
|
#
1.50 |
|
08-Jul-2002 |
atatat |
Add systrace(1) support to rc.subr. Most services (eg, ${name} is 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.
|
Revision tags: netbsd-1-6-base
|
#
1.49 |
|
21-May-2002 |
lukem |
branches: 1.49.2; When using backup_uses_rcs=YES in backup_file(), after checking the file 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").
|
#
1.48 |
|
18-Apr-2002 |
lukem |
consistently set rc_(fast|force)=yes
|
#
1.47 |
|
27-Mar-2002 |
lukem |
Replace $critical_filesystems_beforenet with $critical_filesystems_local . 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!
|
#
1.46 |
|
22-Mar-2002 |
lukem |
- 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].
|
#
1.45 |
|
21-Mar-2002 |
lukem |
- Add run_rc_command() control variable $command_interpreter 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.
|
#
1.44 |
|
13-Mar-2002 |
lukem |
Use ${_arg}_postcmd even if we're not using the default ${_arg}_cmd method.
|
#
1.43 |
|
13-Mar-2002 |
lukem |
Implement ${_arg}_postcmd support, which is run if a default start/stop/reload/restart operation succeeds (i.e, zero exit code). Code from Lubomir Sedlacik <salo@Xtrmntr.org>.
|
#
1.42 |
|
25-Feb-2002 |
lukem |
Fixes derived from [bin/15563] submitted by Ron Roskens: - 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.
|
#
1.41 |
|
25-Feb-2002 |
lukem |
fix spelo. crank copyright year
|
#
1.40 |
|
25-Feb-2002 |
lukem |
Don't run "status" as if "force" is set, thus reverting part of rev 1.29. 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.
|
#
1.39 |
|
25-Feb-2002 |
lukem |
run_rc_script() improvements: - 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
|
#
1.38 |
|
19-Nov-2001 |
lukem |
Add reverse_list(), which prints the reverse of the list of words. Doesn't attempt to handle words with whitespace, etc.
|
#
1.37 |
|
18-Jun-2001 |
lukem |
Improve run_rc_script(): - 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].
|
#
1.36 |
|
10-May-2001 |
atatat |
When using rcs to track backups, force the rcs archive to be unlocked, use only non-strict locking, and leave the archives unlocked after checking in changes.
|
#
1.35 |
|
09-May-2001 |
lukem |
* change wait_for_pids() to spin forever (rather than just ~ 65 seconds). * 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 ?)
|
#
1.34 |
|
07-May-2001 |
lukem |
Don't try and use single quotes in the RHS of a ${ :+ } expansion 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.
|
#
1.33 |
|
18-Apr-2001 |
lukem |
* provide wait_for_pids(), which spins until all the given pids don't exist * 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.
|
#
1.32 |
|
06-Apr-2001 |
lukem |
clarify that ${name}_groups is comma separated
|
#
1.31 |
|
04-Apr-2001 |
atatat |
Provide the capability of storing backups via RCS instead of just a "current" and a "last" (which is useless if you wanna know what you changed last week). Set the default to on.
|
#
1.30 |
|
28-Feb-2001 |
lukem |
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
|
#
1.29 |
|
17-Nov-2000 |
lukem |
* always run `status'; i.e, ignore the setting of $rcvar just like `rcvar' does. * 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.
|
#
1.28 |
|
06-Nov-2000 |
lukem |
when doing `status', return non-zero if the program isn't running. request by thorpej.
|
#
1.27 |
|
05-Nov-2000 |
lukem |
when running `forcerestart', call the underlying `stop' and `start' with the `force' prefix as well
|
#
1.26 |
|
07-Oct-2000 |
lukem |
use ${foo##*/} instead of `basename $foo`. as suggested (with minor variation) by Toru Nishimura <nisimura@itc.aist-nara.ac.jp>
|
#
1.25 |
|
01-Oct-2000 |
lukem |
remove unnecessary leading `$' on warnings printed for $required_dirs and $required_files.
|
#
1.24 |
|
19-Sep-2000 |
lukem |
- only perform the checkyesno on the variable named in $rcvar (rather than 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
|
#
1.23 |
|
19-Aug-2000 |
lukem |
support ${name}_nice even when using ${name}_chroot. per discussion with mrg...
|
#
1.22 |
|
17-Aug-2000 |
lukem |
add support for ${name}_chroot, which chroot(8)s before running the command. 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 :-]
|
#
1.21 |
|
20-Jul-2000 |
lukem |
in err() and warn() put a : between the ERROR/WARNING label and the message
|
Revision tags: netbsd-1-5-base
|
#
1.20 |
|
09-Jun-2000 |
fvdl |
branches: 1.20.2; Add and rc.conf.d directory. If a config file for command X exists (/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
|
Revision tags: minoura-xpg4dl-base
|
#
1.19 |
|
13-May-2000 |
lukem |
branches: 1.19.2; Implement load_rc_config(), which takes the config name as an argument. 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/*.
|
#
1.18 |
|
13-May-2000 |
lukem |
implement three new variables for run_rc_command: - ${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 :)
|
#
1.17 |
|
30-Apr-2000 |
lukem |
- prefix some more local variables with `_' (when you have a convention, stick to it :-) - simplify run_rc_script (no need to support fast* or force* here...) - clarify some comments
|
#
1.16 |
|
30-Apr-2000 |
lukem |
change run_rc_command() to take the list of extra commands supported 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.
|
#
1.15 |
|
28-Apr-2000 |
lukem |
in check_pidfile and check_process, also match "(" + `basename prog` + ")" . noted by veego@
|
#
1.14 |
|
26-Apr-2000 |
lukem |
don't bother checking rc_configured each time run_rc_command executes; once in /etc/rc is enough
|
#
1.13 |
|
22-Apr-2000 |
lukem |
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).
|
#
1.12 |
|
19-Apr-2000 |
simonb |
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.
|
#
1.11 |
|
10-Mar-2000 |
lukem |
* add: 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
|
Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
|
#
1.10 |
|
07-Jul-1999 |
drochner |
repair diskless startup: "netstart" needs "sysctl" and "awk" now, thus "/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...
|
#
1.9 |
|
28-Apr-1999 |
nathanw |
Move the knowledge that /usr and /var should be mounted early from 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.
|
#
1.8 |
|
13-Apr-1999 |
cjs |
When checking local status, jJust ignore not-found filesystems, rather than printing an error, just as we do when we try to mount it.
|
Revision tags: netbsd-1-4-base
|
#
1.7 |
|
01-Apr-1999 |
cjs |
branches: 1.7.2; 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.
|
#
1.6 |
|
24-Mar-1999 |
mellon |
- Move critical filesystem mounting code into a shell function and put that in rc.subr. - Support critfs_require_network rc.conf variable.
|
#
1.5 |
|
28-Feb-1998 |
lukem |
improve description comment
|
#
1.4 |
|
28-Feb-1998 |
lukem |
* add synonyms for "yes": "true", "on", and "1" * add synonyms for "no": "false", "off", and "0" * remove unnecessary trailing semicolons (this is sh, not C)
|
#
1.3 |
|
26-Jan-1998 |
lukem |
convert 'if .. else .. fi' into a 'case .. esac', and allow for any uppercase/lowercase variations of 'yes' and 'no'. fixes [misc/4887] sent in by "John F. Woods" <jfw@jfwhome.funhouse.com>
|
Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
|
#
1.2 |
|
30-Aug-1997 |
cjs |
Prune unused function.
|
#
1.1 |
|
29-Aug-1997 |
cjs |
Split rc.conf variables for starting programs into two: an on/off 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.
|
#
1.105 |
|
17-Sep-2020 |
otis |
Fix waiting for PIDs on stop.
Fix expansion of positional parameters. Also move the local variable declaration to more apropriate place.
|
Revision tags: phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406
|
#
1.104 |
|
05-Apr-2020 |
christos |
Prevent waiting for processes to exit forever by introducing _rc_kill_ntries, which if set, will SIGKILL the processes that did not die yet.
|
Revision tags: is-mlppp-base netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930
|
#
1.103 |
|
23-Sep-2018 |
kre |
rc.subr can be used in install images (from sysinst) so must use only POSIX specified test uses (no -a or -o). Also, use printf always, rather than echo (replace echo as a function using echo with one which uses printf).
|
Revision tags: pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
|
#
1.102 |
|
11-Apr-2018 |
christos |
branches: 1.102.2; Hide ps error about processes not found (we could be more specific...) It is superfluous, since we print: foo not running? (check /var/run/foo/foo.pid).
|
Revision tags: pgoyette-compat-0407
|
#
1.101 |
|
01-Apr-2018 |
kre |
PR misc/53145 (Bruce Lilly)
Use ps -A instead of ps -ax (-A means -ax, but -A is posix, -x is not) Use ps -o args instead of ps -o command (same reason).
This makes no difference when the ps used is /bin/ps on NetBSD, but can make a difference when some other ps command gets invoked instead.
XXX pullup -8
|
Revision tags: pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
|
#
1.100 |
|
13-Apr-2017 |
christos |
branches: 1.100.4; 1.100.10; remove env.
|
#
1.99 |
|
21-Mar-2017 |
christos |
Clear rc variables that contain state that is gone after the boot process is complete, so that scripts invoked from powerd don't think that they are still invoked by the rc system and fail. Reported by rudolf @ tech-userlevel
|
Revision tags: pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
|
#
1.98 |
|
06-Mar-2016 |
christos |
branches: 1.98.2; 1.98.4; Introduce kat() a built-in version of cat(1) that strips shell-like comments.
|
#
1.97 |
|
31-Oct-2015 |
phx |
PR misc/50046 Remove the expensive tests in _have_rc_postprocessor(), as proposed by apb@. It more than halves the multiuser boot time on slow machines and brings it back near to the previous level.
|
#
1.96 |
|
07-Oct-2014 |
roy |
sleep for 0.05 seconds instead of 2 seconds when checking if the pids are still alive for a much faster exit.
|
#
1.95 |
|
21-Sep-2014 |
roy |
Add checkyesnox function so we can test a configurable without being warned of its non-existance.
|
Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
|
#
1.94 |
|
27-Jul-2014 |
apb |
branches: 1.94.2; 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.
|
#
1.93 |
|
22-Jul-2014 |
wiz |
'file system' for consistency with documentation (instead of 'filesystem').
|
Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
|
#
1.92 |
|
17-Dec-2012 |
apb |
branches: 1.92.8; Add shell implementations of basename and dirname to rc.subr. They are supposed to mimic basename(1) and dirname(1), except that they are usable before /usr/bin is mounted.
|
Revision tags: yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
|
#
1.91 |
|
07-Apr-2012 |
christos |
branches: 1.91.2; back out change that makes onestart work, to be committed at some other time.
|
#
1.90 |
|
07-Apr-2012 |
christos |
give wedges to everyone
|
#
1.89 |
|
07-Apr-2012 |
apb |
The error message when /var is not a file system chhanged from mount: unknown special file or file system `/var' to mount: Unknown special file or file system `/var' so match them both.
|
Revision tags: netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.88 |
|
11-Aug-2011 |
apb |
branches: 1.88.2; 1.88.4; 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.
|
#
1.87 |
|
09-Jun-2011 |
christos |
PR/42642: Ed Ravin: Handle daemons that start with #!/usr/bin/env interp
|
Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.86 |
|
26-Sep-2010 |
apb |
branches: 1.86.4; Add a collapse_backslash_newline function to rc.subr.
|
#
1.85 |
|
08-Jun-2010 |
christos |
use modulo instead of logical and. from pooka
|
#
1.84 |
|
08-Jun-2010 |
christos |
explain why this code is there.
|
#
1.83 |
|
06-Jun-2010 |
christos |
fix conditional, from dholland.
|
#
1.82 |
|
04-Jun-2010 |
christos |
print human readable exit code.
|
#
1.81 |
|
15-Mar-2010 |
jmmv |
Allow the run_rc_command function in rc.subr to pass extra parameters to the command being executed. This is to allow rc.d scripts to do:
run_rc_command "${@}"
instead of:
run_rc_command "${1}"
and let the command handler (start, stop, etc.) receive the arguments after the command name.
None of the default commands allow extra arguments, and they will error out if any are given. This is mostly useful for script-specific commands that are only supposed to be used through the command line and, therefore, need to provide a friendly interface.
Proposed in tech-userlevel@. No major objections except for some minor concerns regarding whether this should be allowed or not at all. Note that I'm not touching any of the rc.d scripts in the base system, so this is effectively a no-op from the user point of view.
|
Revision tags: matt-premerge-20091211
|
#
1.80 |
|
14-Sep-2009 |
apb |
Fix some errors in the way scripts with "KEYWORD: interactive" are handled. There was an inverted test, and "set $_args" had the wrong scope (in several nearly-identical blocks of code).
|
#
1.79 |
|
14-Sep-2009 |
apb |
Add the ability for file systems mounted via mount_critical_filesystems() in rc.subr to be marked as optional. This means that it's not an error if the file system is not mentioned in /etc/fstab. It is still an error if something else goes wrong.
Change the defaults for these two variables in /etc/defaults/rc.conf: critical_filesystems_local="OPTIONAL:/var" critical_filesystems_remote="OPTIONAL:/usr"
|
#
1.78 |
|
11-Sep-2009 |
apb |
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.
|
#
1.77 |
|
05-Sep-2009 |
apb |
Change multiple spaces to tabs on one line
|
#
1.76 |
|
10-Jul-2009 |
christos |
1. centralize the fsck error handling 2. don't check if root is on nfs 3. reboot -n if root was modified as the manual page suggests
|
Revision tags: jym-xensuspend-nbase jym-xensuspend-base
|
#
1.75 |
|
28-Apr-2009 |
reed |
Get rid of extra space in Usage statement.
|
Revision tags: mjf-devfs2-base2
|
#
1.74 |
|
06-Dec-2008 |
salo |
branches: 1.74.2; A very old patch sitting in my tree..
When rc scripts are started from interactive shell, be nice and when user tries to start an unconfigured service, point him to rc.conf(5) and tell him about the one* keyword. Also be more user friendly when an unknown argument is entered.
Example:
# /etc/rc.d/cron start $cron is not enabled - see rc.conf(5). Use the following if you wish to perform the operation: /etc/rc.d/cron onestart
# /etc/rc.d/cron nonsense /etc/rc.d/cron: unknown directive 'nonsense'. Usage: /etc/rc.d/cron [fast|force|one](start stop restart rcvar status poll)
Inspired by discussion on tech-userlevel:
http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0010.html http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0011.html http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0012.html
Reminded about it and reviewed by <lukem>
|
Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 mjf-devfs2-base
|
#
1.73 |
|
23-Jun-2008 |
dholland |
branches: 1.73.2; fix typo
|
Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
|
#
1.72 |
|
22-May-2008 |
he |
Add support for optionally setting some environment variables before starting ${command}, via ${name}_env.
Discussed with lukem.
|
Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2
|
#
1.71 |
|
30-Apr-2008 |
martin |
branches: 1.71.2; Convert TNF licenses to new 2 clause variant
|
Revision tags: yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-base mjf-devfs-base matt-armv6-nbase matt-armv6-base hpcarm-cleanup-base
|
#
1.70 |
|
31-Dec-2007 |
ad |
branches: 1.70.2; 1.70.6; 1.70.8; Remove systrace. Ok core@.
|
Revision tags: matt-armv6-prevmlocking cube-autoconf-base matt-mips64-base
|
#
1.69 |
|
06-Apr-2007 |
apb |
branches: 1.69.4; * Add a stop_boot() function in rc.subr, to terminate a multi-user boot by killing the parent process. The parent's PID is saved in $RC_PID. * In all rc.d/* scripts that previously tried to stop the boot, replace in-line code with "stop_boot". * Document this.
This should fix PR 29822.
|
#
1.68 |
|
27-Jan-2007 |
hubertf |
_find_processes(): in addition to the existing "interpreter: /path/to/daemon" also recognize "interpreter: daemon" in ps(1) output.
That case statement should be rewritten with expr(1) if more flexibility is needed.
Fixes PR 35366 by Dominik Joe Pantucek, debugged with much assistance by him on IRC.
|
Revision tags: netbsd-4-base
|
#
1.67 |
|
07-Oct-2006 |
elad |
branches: 1.67.2; PR/32004: Ed Ravin: command interpreter test in rc.subr doesn't accomodate chroots
Patch applied, thanks!
okay apb@
|
Revision tags: abandoned-netbsd-4-base
|
#
1.66 |
|
01-Apr-2006 |
he |
In order to handle some perl scripts running as daemons, add a pattern which also matches "`basename $interpreter`: $command" in the ps listing. Should fix PR#31932.
|
Revision tags: netbsd-3-0-3-RELEASE netbsd-3-0-2-RELEASE netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
|
#
1.65 |
|
12-Oct-2004 |
lukem |
branches: 1.65.2; * Implement load_rc_config_var cmd var to load the rc.conf(5) configuration for cmd and set var in the current shell, using 'load_rc_config var' in a sub-shell to avoid unwanted side-effects.
* Improve required_vars warning message.
|
#
1.64 |
|
13-Aug-2004 |
mycroft |
Add an _rc_subr_loaded variable, set to ":" by rc.subr. Scripts can use this for a speedup by doing: $_rc_subr_loaded . /etc/rc.subr
|
#
1.63 |
|
03-May-2004 |
lukem |
When performing "start", "stop" or "reload" in run_rc_command(), send any "<name> already running" or "<name> not running" messages to stderr instead of stdout before the (existing) non-zero exit.
|
#
1.62 |
|
02-Apr-2004 |
jmmv |
Introduce and use the rcvar_manpage variable, which contains the manual page name where the user should look at for documentation about rcvar. It defaults to 'rc.subr(5)', as rc.subr is mainly used by rc.d scripts.
This variable is useful to let the daily, weekly, monthly and security scripts tune the warning message shown when any of the variables they handle is not properly set.
Closes PR misc/23908.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.61 |
|
06-Jan-2004 |
lukem |
branches: 1.61.4; Implement ``one'' prefix to allow a "one shot" operation as if ${rcvar}=yes yet all the other prerequisite tests are still performed. The existing ``force'' prefix is a sledgehammer that ignores all the prerequisite checks and always returns a zero exit status; this is a more gentle approach to the problem of "manipulate this disabled service without editing rc.conf(5)".
|
#
1.60 |
|
26-Jul-2003 |
lukem |
Add "*,v" to the list of scratch files to skip. Suggested by Johnny Lam / Alistair Crooks
|
#
1.59 |
|
04-Jul-2003 |
lukem |
Revert previous; the "return" if rc.subr had already loaded had issues in some circumstances where run_rc_script()'s sourcing of an rc.d file which then sourced rc.subr, the `optimisation' in rc.subr to "return as we're already loaded" would finish more than just the inner-most sourcing. I haven't tracked down the exact issue, but removing the `optimisation' fixes the problem I noticed in starting up certain rc.d scripts, and may fix [bin/22053] as well.
|
#
1.58 |
|
27-Jun-2003 |
lukem |
If _rc_subr_loaded=true, "return" immediately, otherwise set that var and continue as normal. Gains ~ 2 seconds on 110 runs of ". rc.subr" on a shark. Suggested by Andrew Cagney in [bin/18400]
|
#
1.57 |
|
27-Jun-2003 |
lukem |
run_rc_command(): when checking if ${command} exists before executing it, be sure to check under ${name_chroot} (if set). Fix from Ed Ravin in [bin/18523]
|
#
1.56 |
|
03-Jun-2003 |
christos |
Use more concise shell syntax: 1. for i in $* -> for i 2. foo=$* -> foo="$@"
|
#
1.55 |
|
05-Jan-2003 |
lukem |
Fix logic error I introduced recently into mount_critical_filesystems(). Noted by kilbi@rad.rwth-aachen.de in [bin/19703].
|
#
1.54 |
|
05-Jan-2003 |
lukem |
'if ! command;' is not POSIX sh, even though our /bin/sh supports it
|
#
1.53 |
|
04-Jan-2003 |
lukem |
Change how internal boolean variables are used to: if ! ${_somevar:-false}; then _somevar=true fi (Consisent, slightly quicker, and slightly cleaner)
|
Revision tags: fvdl_fs64_base
|
#
1.52 |
|
26-Aug-2002 |
abs |
Append ' - see rc.conf(5)' to unset variable warning: /etc/rc.d/fu: WARNING: $fu is not set properly - see rc.conf(5). Add a note to rc.conf that third party packages may test for additional variables.
|
#
1.51 |
|
25-Jul-2002 |
grant |
add test for /usr/bin/logger in warn/err.
|
#
1.50 |
|
08-Jul-2002 |
atatat |
Add systrace(1) support to rc.subr. Most services (eg, ${name} is 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.
|
Revision tags: netbsd-1-6-base
|
#
1.49 |
|
21-May-2002 |
lukem |
branches: 1.49.2; When using backup_uses_rcs=YES in backup_file(), after checking the file 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").
|
#
1.48 |
|
18-Apr-2002 |
lukem |
consistently set rc_(fast|force)=yes
|
#
1.47 |
|
27-Mar-2002 |
lukem |
Replace $critical_filesystems_beforenet with $critical_filesystems_local . 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!
|
#
1.46 |
|
22-Mar-2002 |
lukem |
- 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].
|
#
1.45 |
|
21-Mar-2002 |
lukem |
- Add run_rc_command() control variable $command_interpreter 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.
|
#
1.44 |
|
13-Mar-2002 |
lukem |
Use ${_arg}_postcmd even if we're not using the default ${_arg}_cmd method.
|
#
1.43 |
|
13-Mar-2002 |
lukem |
Implement ${_arg}_postcmd support, which is run if a default start/stop/reload/restart operation succeeds (i.e, zero exit code). Code from Lubomir Sedlacik <salo@Xtrmntr.org>.
|
#
1.42 |
|
25-Feb-2002 |
lukem |
Fixes derived from [bin/15563] submitted by Ron Roskens: - 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.
|
#
1.41 |
|
25-Feb-2002 |
lukem |
fix spelo. crank copyright year
|
#
1.40 |
|
25-Feb-2002 |
lukem |
Don't run "status" as if "force" is set, thus reverting part of rev 1.29. 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.
|
#
1.39 |
|
25-Feb-2002 |
lukem |
run_rc_script() improvements: - 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
|
#
1.38 |
|
19-Nov-2001 |
lukem |
Add reverse_list(), which prints the reverse of the list of words. Doesn't attempt to handle words with whitespace, etc.
|
#
1.37 |
|
18-Jun-2001 |
lukem |
Improve run_rc_script(): - 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].
|
#
1.36 |
|
10-May-2001 |
atatat |
When using rcs to track backups, force the rcs archive to be unlocked, use only non-strict locking, and leave the archives unlocked after checking in changes.
|
#
1.35 |
|
09-May-2001 |
lukem |
* change wait_for_pids() to spin forever (rather than just ~ 65 seconds). * 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 ?)
|
#
1.34 |
|
07-May-2001 |
lukem |
Don't try and use single quotes in the RHS of a ${ :+ } expansion 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.
|
#
1.33 |
|
18-Apr-2001 |
lukem |
* provide wait_for_pids(), which spins until all the given pids don't exist * 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.
|
#
1.32 |
|
06-Apr-2001 |
lukem |
clarify that ${name}_groups is comma separated
|
#
1.31 |
|
04-Apr-2001 |
atatat |
Provide the capability of storing backups via RCS instead of just a "current" and a "last" (which is useless if you wanna know what you changed last week). Set the default to on.
|
#
1.30 |
|
28-Feb-2001 |
lukem |
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
|
#
1.29 |
|
17-Nov-2000 |
lukem |
* always run `status'; i.e, ignore the setting of $rcvar just like `rcvar' does. * 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.
|
#
1.28 |
|
06-Nov-2000 |
lukem |
when doing `status', return non-zero if the program isn't running. request by thorpej.
|
#
1.27 |
|
05-Nov-2000 |
lukem |
when running `forcerestart', call the underlying `stop' and `start' with the `force' prefix as well
|
#
1.26 |
|
07-Oct-2000 |
lukem |
use ${foo##*/} instead of `basename $foo`. as suggested (with minor variation) by Toru Nishimura <nisimura@itc.aist-nara.ac.jp>
|
#
1.25 |
|
01-Oct-2000 |
lukem |
remove unnecessary leading `$' on warnings printed for $required_dirs and $required_files.
|
#
1.24 |
|
19-Sep-2000 |
lukem |
- only perform the checkyesno on the variable named in $rcvar (rather than 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
|
#
1.23 |
|
19-Aug-2000 |
lukem |
support ${name}_nice even when using ${name}_chroot. per discussion with mrg...
|
#
1.22 |
|
17-Aug-2000 |
lukem |
add support for ${name}_chroot, which chroot(8)s before running the command. 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 :-]
|
#
1.21 |
|
20-Jul-2000 |
lukem |
in err() and warn() put a : between the ERROR/WARNING label and the message
|
Revision tags: netbsd-1-5-base
|
#
1.20 |
|
09-Jun-2000 |
fvdl |
branches: 1.20.2; Add and rc.conf.d directory. If a config file for command X exists (/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
|
Revision tags: minoura-xpg4dl-base
|
#
1.19 |
|
13-May-2000 |
lukem |
branches: 1.19.2; Implement load_rc_config(), which takes the config name as an argument. 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/*.
|
#
1.18 |
|
13-May-2000 |
lukem |
implement three new variables for run_rc_command: - ${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 :)
|
#
1.17 |
|
30-Apr-2000 |
lukem |
- prefix some more local variables with `_' (when you have a convention, stick to it :-) - simplify run_rc_script (no need to support fast* or force* here...) - clarify some comments
|
#
1.16 |
|
30-Apr-2000 |
lukem |
change run_rc_command() to take the list of extra commands supported 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.
|
#
1.15 |
|
28-Apr-2000 |
lukem |
in check_pidfile and check_process, also match "(" + `basename prog` + ")" . noted by veego@
|
#
1.14 |
|
26-Apr-2000 |
lukem |
don't bother checking rc_configured each time run_rc_command executes; once in /etc/rc is enough
|
#
1.13 |
|
22-Apr-2000 |
lukem |
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).
|
#
1.12 |
|
19-Apr-2000 |
simonb |
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.
|
#
1.11 |
|
10-Mar-2000 |
lukem |
* add: 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
|
Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
|
#
1.10 |
|
07-Jul-1999 |
drochner |
repair diskless startup: "netstart" needs "sysctl" and "awk" now, thus "/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...
|
#
1.9 |
|
28-Apr-1999 |
nathanw |
Move the knowledge that /usr and /var should be mounted early from 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.
|
#
1.8 |
|
13-Apr-1999 |
cjs |
When checking local status, jJust ignore not-found filesystems, rather than printing an error, just as we do when we try to mount it.
|
Revision tags: netbsd-1-4-base
|
#
1.7 |
|
01-Apr-1999 |
cjs |
branches: 1.7.2; 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.
|
#
1.6 |
|
24-Mar-1999 |
mellon |
- Move critical filesystem mounting code into a shell function and put that in rc.subr. - Support critfs_require_network rc.conf variable.
|
#
1.5 |
|
28-Feb-1998 |
lukem |
improve description comment
|
#
1.4 |
|
28-Feb-1998 |
lukem |
* add synonyms for "yes": "true", "on", and "1" * add synonyms for "no": "false", "off", and "0" * remove unnecessary trailing semicolons (this is sh, not C)
|
#
1.3 |
|
26-Jan-1998 |
lukem |
convert 'if .. else .. fi' into a 'case .. esac', and allow for any uppercase/lowercase variations of 'yes' and 'no'. fixes [misc/4887] sent in by "John F. Woods" <jfw@jfwhome.funhouse.com>
|
Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
|
#
1.2 |
|
30-Aug-1997 |
cjs |
Prune unused function.
|
#
1.1 |
|
29-Aug-1997 |
cjs |
Split rc.conf variables for starting programs into two: an on/off 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.
|
#
1.104 |
|
05-Apr-2020 |
christos |
Prevent waiting for processes to exit forever by introducing _rc_kill_ntries, which if set, will SIGKILL the processes that did not die yet.
|
Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930
|
#
1.103 |
|
23-Sep-2018 |
kre |
rc.subr can be used in install images (from sysinst) so must use only POSIX specified test uses (no -a or -o). Also, use printf always, rather than echo (replace echo as a function using echo with one which uses printf).
|
Revision tags: pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
|
#
1.102 |
|
11-Apr-2018 |
christos |
branches: 1.102.2; Hide ps error about processes not found (we could be more specific...) It is superfluous, since we print: foo not running? (check /var/run/foo/foo.pid).
|
Revision tags: pgoyette-compat-0407
|
#
1.101 |
|
01-Apr-2018 |
kre |
PR misc/53145 (Bruce Lilly)
Use ps -A instead of ps -ax (-A means -ax, but -A is posix, -x is not) Use ps -o args instead of ps -o command (same reason).
This makes no difference when the ps used is /bin/ps on NetBSD, but can make a difference when some other ps command gets invoked instead.
XXX pullup -8
|
Revision tags: pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
|
#
1.100 |
|
13-Apr-2017 |
christos |
branches: 1.100.4; 1.100.10; remove env.
|
#
1.99 |
|
21-Mar-2017 |
christos |
Clear rc variables that contain state that is gone after the boot process is complete, so that scripts invoked from powerd don't think that they are still invoked by the rc system and fail. Reported by rudolf @ tech-userlevel
|
Revision tags: pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
|
#
1.98 |
|
06-Mar-2016 |
christos |
branches: 1.98.2; 1.98.4; Introduce kat() a built-in version of cat(1) that strips shell-like comments.
|
#
1.97 |
|
31-Oct-2015 |
phx |
PR misc/50046 Remove the expensive tests in _have_rc_postprocessor(), as proposed by apb@. It more than halves the multiuser boot time on slow machines and brings it back near to the previous level.
|
#
1.96 |
|
07-Oct-2014 |
roy |
sleep for 0.05 seconds instead of 2 seconds when checking if the pids are still alive for a much faster exit.
|
#
1.95 |
|
21-Sep-2014 |
roy |
Add checkyesnox function so we can test a configurable without being warned of its non-existance.
|
Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
|
#
1.94 |
|
27-Jul-2014 |
apb |
branches: 1.94.2; 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.
|
#
1.93 |
|
22-Jul-2014 |
wiz |
'file system' for consistency with documentation (instead of 'filesystem').
|
Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
|
#
1.92 |
|
17-Dec-2012 |
apb |
branches: 1.92.8; Add shell implementations of basename and dirname to rc.subr. They are supposed to mimic basename(1) and dirname(1), except that they are usable before /usr/bin is mounted.
|
Revision tags: yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
|
#
1.91 |
|
07-Apr-2012 |
christos |
branches: 1.91.2; back out change that makes onestart work, to be committed at some other time.
|
#
1.90 |
|
07-Apr-2012 |
christos |
give wedges to everyone
|
#
1.89 |
|
07-Apr-2012 |
apb |
The error message when /var is not a file system chhanged from mount: unknown special file or file system `/var' to mount: Unknown special file or file system `/var' so match them both.
|
Revision tags: netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.88 |
|
11-Aug-2011 |
apb |
branches: 1.88.2; 1.88.4; 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.
|
#
1.87 |
|
09-Jun-2011 |
christos |
PR/42642: Ed Ravin: Handle daemons that start with #!/usr/bin/env interp
|
Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.86 |
|
26-Sep-2010 |
apb |
branches: 1.86.4; Add a collapse_backslash_newline function to rc.subr.
|
#
1.85 |
|
08-Jun-2010 |
christos |
use modulo instead of logical and. from pooka
|
#
1.84 |
|
08-Jun-2010 |
christos |
explain why this code is there.
|
#
1.83 |
|
06-Jun-2010 |
christos |
fix conditional, from dholland.
|
#
1.82 |
|
04-Jun-2010 |
christos |
print human readable exit code.
|
#
1.81 |
|
15-Mar-2010 |
jmmv |
Allow the run_rc_command function in rc.subr to pass extra parameters to the command being executed. This is to allow rc.d scripts to do:
run_rc_command "${@}"
instead of:
run_rc_command "${1}"
and let the command handler (start, stop, etc.) receive the arguments after the command name.
None of the default commands allow extra arguments, and they will error out if any are given. This is mostly useful for script-specific commands that are only supposed to be used through the command line and, therefore, need to provide a friendly interface.
Proposed in tech-userlevel@. No major objections except for some minor concerns regarding whether this should be allowed or not at all. Note that I'm not touching any of the rc.d scripts in the base system, so this is effectively a no-op from the user point of view.
|
Revision tags: matt-premerge-20091211
|
#
1.80 |
|
14-Sep-2009 |
apb |
Fix some errors in the way scripts with "KEYWORD: interactive" are handled. There was an inverted test, and "set $_args" had the wrong scope (in several nearly-identical blocks of code).
|
#
1.79 |
|
14-Sep-2009 |
apb |
Add the ability for file systems mounted via mount_critical_filesystems() in rc.subr to be marked as optional. This means that it's not an error if the file system is not mentioned in /etc/fstab. It is still an error if something else goes wrong.
Change the defaults for these two variables in /etc/defaults/rc.conf: critical_filesystems_local="OPTIONAL:/var" critical_filesystems_remote="OPTIONAL:/usr"
|
#
1.78 |
|
11-Sep-2009 |
apb |
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.
|
#
1.77 |
|
05-Sep-2009 |
apb |
Change multiple spaces to tabs on one line
|
#
1.76 |
|
10-Jul-2009 |
christos |
1. centralize the fsck error handling 2. don't check if root is on nfs 3. reboot -n if root was modified as the manual page suggests
|
Revision tags: jym-xensuspend-nbase jym-xensuspend-base
|
#
1.75 |
|
28-Apr-2009 |
reed |
Get rid of extra space in Usage statement.
|
Revision tags: mjf-devfs2-base2
|
#
1.74 |
|
06-Dec-2008 |
salo |
branches: 1.74.2; A very old patch sitting in my tree..
When rc scripts are started from interactive shell, be nice and when user tries to start an unconfigured service, point him to rc.conf(5) and tell him about the one* keyword. Also be more user friendly when an unknown argument is entered.
Example:
# /etc/rc.d/cron start $cron is not enabled - see rc.conf(5). Use the following if you wish to perform the operation: /etc/rc.d/cron onestart
# /etc/rc.d/cron nonsense /etc/rc.d/cron: unknown directive 'nonsense'. Usage: /etc/rc.d/cron [fast|force|one](start stop restart rcvar status poll)
Inspired by discussion on tech-userlevel:
http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0010.html http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0011.html http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0012.html
Reminded about it and reviewed by <lukem>
|
Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 mjf-devfs2-base
|
#
1.73 |
|
23-Jun-2008 |
dholland |
branches: 1.73.2; fix typo
|
Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
|
#
1.72 |
|
22-May-2008 |
he |
Add support for optionally setting some environment variables before starting ${command}, via ${name}_env.
Discussed with lukem.
|
Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2
|
#
1.71 |
|
30-Apr-2008 |
martin |
branches: 1.71.2; Convert TNF licenses to new 2 clause variant
|
Revision tags: yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-base mjf-devfs-base matt-armv6-nbase matt-armv6-base hpcarm-cleanup-base
|
#
1.70 |
|
31-Dec-2007 |
ad |
branches: 1.70.2; 1.70.6; 1.70.8; Remove systrace. Ok core@.
|
Revision tags: matt-armv6-prevmlocking cube-autoconf-base matt-mips64-base
|
#
1.69 |
|
06-Apr-2007 |
apb |
branches: 1.69.4; * Add a stop_boot() function in rc.subr, to terminate a multi-user boot by killing the parent process. The parent's PID is saved in $RC_PID. * In all rc.d/* scripts that previously tried to stop the boot, replace in-line code with "stop_boot". * Document this.
This should fix PR 29822.
|
#
1.68 |
|
27-Jan-2007 |
hubertf |
_find_processes(): in addition to the existing "interpreter: /path/to/daemon" also recognize "interpreter: daemon" in ps(1) output.
That case statement should be rewritten with expr(1) if more flexibility is needed.
Fixes PR 35366 by Dominik Joe Pantucek, debugged with much assistance by him on IRC.
|
Revision tags: netbsd-4-base
|
#
1.67 |
|
07-Oct-2006 |
elad |
branches: 1.67.2; PR/32004: Ed Ravin: command interpreter test in rc.subr doesn't accomodate chroots
Patch applied, thanks!
okay apb@
|
Revision tags: abandoned-netbsd-4-base
|
#
1.66 |
|
01-Apr-2006 |
he |
In order to handle some perl scripts running as daemons, add a pattern which also matches "`basename $interpreter`: $command" in the ps listing. Should fix PR#31932.
|
Revision tags: netbsd-3-0-3-RELEASE netbsd-3-0-2-RELEASE netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
|
#
1.65 |
|
12-Oct-2004 |
lukem |
branches: 1.65.2; * Implement load_rc_config_var cmd var to load the rc.conf(5) configuration for cmd and set var in the current shell, using 'load_rc_config var' in a sub-shell to avoid unwanted side-effects.
* Improve required_vars warning message.
|
#
1.64 |
|
13-Aug-2004 |
mycroft |
Add an _rc_subr_loaded variable, set to ":" by rc.subr. Scripts can use this for a speedup by doing: $_rc_subr_loaded . /etc/rc.subr
|
#
1.63 |
|
03-May-2004 |
lukem |
When performing "start", "stop" or "reload" in run_rc_command(), send any "<name> already running" or "<name> not running" messages to stderr instead of stdout before the (existing) non-zero exit.
|
#
1.62 |
|
02-Apr-2004 |
jmmv |
Introduce and use the rcvar_manpage variable, which contains the manual page name where the user should look at for documentation about rcvar. It defaults to 'rc.subr(5)', as rc.subr is mainly used by rc.d scripts.
This variable is useful to let the daily, weekly, monthly and security scripts tune the warning message shown when any of the variables they handle is not properly set.
Closes PR misc/23908.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.61 |
|
06-Jan-2004 |
lukem |
branches: 1.61.4; Implement ``one'' prefix to allow a "one shot" operation as if ${rcvar}=yes yet all the other prerequisite tests are still performed. The existing ``force'' prefix is a sledgehammer that ignores all the prerequisite checks and always returns a zero exit status; this is a more gentle approach to the problem of "manipulate this disabled service without editing rc.conf(5)".
|
#
1.60 |
|
26-Jul-2003 |
lukem |
Add "*,v" to the list of scratch files to skip. Suggested by Johnny Lam / Alistair Crooks
|
#
1.59 |
|
04-Jul-2003 |
lukem |
Revert previous; the "return" if rc.subr had already loaded had issues in some circumstances where run_rc_script()'s sourcing of an rc.d file which then sourced rc.subr, the `optimisation' in rc.subr to "return as we're already loaded" would finish more than just the inner-most sourcing. I haven't tracked down the exact issue, but removing the `optimisation' fixes the problem I noticed in starting up certain rc.d scripts, and may fix [bin/22053] as well.
|
#
1.58 |
|
27-Jun-2003 |
lukem |
If _rc_subr_loaded=true, "return" immediately, otherwise set that var and continue as normal. Gains ~ 2 seconds on 110 runs of ". rc.subr" on a shark. Suggested by Andrew Cagney in [bin/18400]
|
#
1.57 |
|
27-Jun-2003 |
lukem |
run_rc_command(): when checking if ${command} exists before executing it, be sure to check under ${name_chroot} (if set). Fix from Ed Ravin in [bin/18523]
|
#
1.56 |
|
03-Jun-2003 |
christos |
Use more concise shell syntax: 1. for i in $* -> for i 2. foo=$* -> foo="$@"
|
#
1.55 |
|
05-Jan-2003 |
lukem |
Fix logic error I introduced recently into mount_critical_filesystems(). Noted by kilbi@rad.rwth-aachen.de in [bin/19703].
|
#
1.54 |
|
05-Jan-2003 |
lukem |
'if ! command;' is not POSIX sh, even though our /bin/sh supports it
|
#
1.53 |
|
04-Jan-2003 |
lukem |
Change how internal boolean variables are used to: if ! ${_somevar:-false}; then _somevar=true fi (Consisent, slightly quicker, and slightly cleaner)
|
Revision tags: fvdl_fs64_base
|
#
1.52 |
|
26-Aug-2002 |
abs |
Append ' - see rc.conf(5)' to unset variable warning: /etc/rc.d/fu: WARNING: $fu is not set properly - see rc.conf(5). Add a note to rc.conf that third party packages may test for additional variables.
|
#
1.51 |
|
25-Jul-2002 |
grant |
add test for /usr/bin/logger in warn/err.
|
#
1.50 |
|
08-Jul-2002 |
atatat |
Add systrace(1) support to rc.subr. Most services (eg, ${name} is 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.
|
Revision tags: netbsd-1-6-base
|
#
1.49 |
|
21-May-2002 |
lukem |
branches: 1.49.2; When using backup_uses_rcs=YES in backup_file(), after checking the file 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").
|
#
1.48 |
|
18-Apr-2002 |
lukem |
consistently set rc_(fast|force)=yes
|
#
1.47 |
|
27-Mar-2002 |
lukem |
Replace $critical_filesystems_beforenet with $critical_filesystems_local . 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!
|
#
1.46 |
|
22-Mar-2002 |
lukem |
- 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].
|
#
1.45 |
|
21-Mar-2002 |
lukem |
- Add run_rc_command() control variable $command_interpreter 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.
|
#
1.44 |
|
13-Mar-2002 |
lukem |
Use ${_arg}_postcmd even if we're not using the default ${_arg}_cmd method.
|
#
1.43 |
|
13-Mar-2002 |
lukem |
Implement ${_arg}_postcmd support, which is run if a default start/stop/reload/restart operation succeeds (i.e, zero exit code). Code from Lubomir Sedlacik <salo@Xtrmntr.org>.
|
#
1.42 |
|
25-Feb-2002 |
lukem |
Fixes derived from [bin/15563] submitted by Ron Roskens: - 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.
|
#
1.41 |
|
25-Feb-2002 |
lukem |
fix spelo. crank copyright year
|
#
1.40 |
|
25-Feb-2002 |
lukem |
Don't run "status" as if "force" is set, thus reverting part of rev 1.29. 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.
|
#
1.39 |
|
25-Feb-2002 |
lukem |
run_rc_script() improvements: - 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
|
#
1.38 |
|
19-Nov-2001 |
lukem |
Add reverse_list(), which prints the reverse of the list of words. Doesn't attempt to handle words with whitespace, etc.
|
#
1.37 |
|
18-Jun-2001 |
lukem |
Improve run_rc_script(): - 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].
|
#
1.36 |
|
10-May-2001 |
atatat |
When using rcs to track backups, force the rcs archive to be unlocked, use only non-strict locking, and leave the archives unlocked after checking in changes.
|
#
1.35 |
|
09-May-2001 |
lukem |
* change wait_for_pids() to spin forever (rather than just ~ 65 seconds). * 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 ?)
|
#
1.34 |
|
07-May-2001 |
lukem |
Don't try and use single quotes in the RHS of a ${ :+ } expansion 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.
|
#
1.33 |
|
18-Apr-2001 |
lukem |
* provide wait_for_pids(), which spins until all the given pids don't exist * 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.
|
#
1.32 |
|
06-Apr-2001 |
lukem |
clarify that ${name}_groups is comma separated
|
#
1.31 |
|
04-Apr-2001 |
atatat |
Provide the capability of storing backups via RCS instead of just a "current" and a "last" (which is useless if you wanna know what you changed last week). Set the default to on.
|
#
1.30 |
|
28-Feb-2001 |
lukem |
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
|
#
1.29 |
|
17-Nov-2000 |
lukem |
* always run `status'; i.e, ignore the setting of $rcvar just like `rcvar' does. * 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.
|
#
1.28 |
|
06-Nov-2000 |
lukem |
when doing `status', return non-zero if the program isn't running. request by thorpej.
|
#
1.27 |
|
05-Nov-2000 |
lukem |
when running `forcerestart', call the underlying `stop' and `start' with the `force' prefix as well
|
#
1.26 |
|
07-Oct-2000 |
lukem |
use ${foo##*/} instead of `basename $foo`. as suggested (with minor variation) by Toru Nishimura <nisimura@itc.aist-nara.ac.jp>
|
#
1.25 |
|
01-Oct-2000 |
lukem |
remove unnecessary leading `$' on warnings printed for $required_dirs and $required_files.
|
#
1.24 |
|
19-Sep-2000 |
lukem |
- only perform the checkyesno on the variable named in $rcvar (rather than 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
|
#
1.23 |
|
19-Aug-2000 |
lukem |
support ${name}_nice even when using ${name}_chroot. per discussion with mrg...
|
#
1.22 |
|
17-Aug-2000 |
lukem |
add support for ${name}_chroot, which chroot(8)s before running the command. 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 :-]
|
#
1.21 |
|
20-Jul-2000 |
lukem |
in err() and warn() put a : between the ERROR/WARNING label and the message
|
Revision tags: netbsd-1-5-base
|
#
1.20 |
|
09-Jun-2000 |
fvdl |
branches: 1.20.2; Add and rc.conf.d directory. If a config file for command X exists (/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
|
Revision tags: minoura-xpg4dl-base
|
#
1.19 |
|
13-May-2000 |
lukem |
branches: 1.19.2; Implement load_rc_config(), which takes the config name as an argument. 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/*.
|
#
1.18 |
|
13-May-2000 |
lukem |
implement three new variables for run_rc_command: - ${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 :)
|
#
1.17 |
|
30-Apr-2000 |
lukem |
- prefix some more local variables with `_' (when you have a convention, stick to it :-) - simplify run_rc_script (no need to support fast* or force* here...) - clarify some comments
|
#
1.16 |
|
30-Apr-2000 |
lukem |
change run_rc_command() to take the list of extra commands supported 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.
|
#
1.15 |
|
28-Apr-2000 |
lukem |
in check_pidfile and check_process, also match "(" + `basename prog` + ")" . noted by veego@
|
#
1.14 |
|
26-Apr-2000 |
lukem |
don't bother checking rc_configured each time run_rc_command executes; once in /etc/rc is enough
|
#
1.13 |
|
22-Apr-2000 |
lukem |
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).
|
#
1.12 |
|
19-Apr-2000 |
simonb |
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.
|
#
1.11 |
|
10-Mar-2000 |
lukem |
* add: 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
|
Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
|
#
1.10 |
|
07-Jul-1999 |
drochner |
repair diskless startup: "netstart" needs "sysctl" and "awk" now, thus "/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...
|
#
1.9 |
|
28-Apr-1999 |
nathanw |
Move the knowledge that /usr and /var should be mounted early from 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.
|
#
1.8 |
|
13-Apr-1999 |
cjs |
When checking local status, jJust ignore not-found filesystems, rather than printing an error, just as we do when we try to mount it.
|
Revision tags: netbsd-1-4-base
|
#
1.7 |
|
01-Apr-1999 |
cjs |
branches: 1.7.2; 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.
|
#
1.6 |
|
24-Mar-1999 |
mellon |
- Move critical filesystem mounting code into a shell function and put that in rc.subr. - Support critfs_require_network rc.conf variable.
|
#
1.5 |
|
28-Feb-1998 |
lukem |
improve description comment
|
#
1.4 |
|
28-Feb-1998 |
lukem |
* add synonyms for "yes": "true", "on", and "1" * add synonyms for "no": "false", "off", and "0" * remove unnecessary trailing semicolons (this is sh, not C)
|
#
1.3 |
|
26-Jan-1998 |
lukem |
convert 'if .. else .. fi' into a 'case .. esac', and allow for any uppercase/lowercase variations of 'yes' and 'no'. fixes [misc/4887] sent in by "John F. Woods" <jfw@jfwhome.funhouse.com>
|
Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
|
#
1.2 |
|
30-Aug-1997 |
cjs |
Prune unused function.
|
#
1.1 |
|
29-Aug-1997 |
cjs |
Split rc.conf variables for starting programs into two: an on/off 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.
|
Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930
|
#
1.103 |
|
23-Sep-2018 |
kre |
rc.subr can be used in install images (from sysinst) so must use only POSIX specified test uses (no -a or -o). Also, use printf always, rather than echo (replace echo as a function using echo with one which uses printf).
|
Revision tags: pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
|
#
1.102 |
|
11-Apr-2018 |
christos |
Hide ps error about processes not found (we could be more specific...) It is superfluous, since we print: foo not running? (check /var/run/foo/foo.pid).
|
Revision tags: pgoyette-compat-0407
|
#
1.101 |
|
01-Apr-2018 |
kre |
PR misc/53145 (Bruce Lilly)
Use ps -A instead of ps -ax (-A means -ax, but -A is posix, -x is not) Use ps -o args instead of ps -o command (same reason).
This makes no difference when the ps used is /bin/ps on NetBSD, but can make a difference when some other ps command gets invoked instead.
XXX pullup -8
|
Revision tags: pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
|
#
1.100 |
|
13-Apr-2017 |
christos |
branches: 1.100.4; 1.100.10; remove env.
|
#
1.99 |
|
21-Mar-2017 |
christos |
Clear rc variables that contain state that is gone after the boot process is complete, so that scripts invoked from powerd don't think that they are still invoked by the rc system and fail. Reported by rudolf @ tech-userlevel
|
Revision tags: pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
|
#
1.98 |
|
06-Mar-2016 |
christos |
branches: 1.98.2; 1.98.4; Introduce kat() a built-in version of cat(1) that strips shell-like comments.
|
#
1.97 |
|
31-Oct-2015 |
phx |
PR misc/50046 Remove the expensive tests in _have_rc_postprocessor(), as proposed by apb@. It more than halves the multiuser boot time on slow machines and brings it back near to the previous level.
|
#
1.96 |
|
07-Oct-2014 |
roy |
sleep for 0.05 seconds instead of 2 seconds when checking if the pids are still alive for a much faster exit.
|
#
1.95 |
|
21-Sep-2014 |
roy |
Add checkyesnox function so we can test a configurable without being warned of its non-existance.
|
Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
|
#
1.94 |
|
27-Jul-2014 |
apb |
branches: 1.94.2; 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.
|
#
1.93 |
|
22-Jul-2014 |
wiz |
'file system' for consistency with documentation (instead of 'filesystem').
|
Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
|
#
1.92 |
|
17-Dec-2012 |
apb |
branches: 1.92.8; Add shell implementations of basename and dirname to rc.subr. They are supposed to mimic basename(1) and dirname(1), except that they are usable before /usr/bin is mounted.
|
Revision tags: yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
|
#
1.91 |
|
07-Apr-2012 |
christos |
branches: 1.91.2; back out change that makes onestart work, to be committed at some other time.
|
#
1.90 |
|
07-Apr-2012 |
christos |
give wedges to everyone
|
#
1.89 |
|
07-Apr-2012 |
apb |
The error message when /var is not a file system chhanged from mount: unknown special file or file system `/var' to mount: Unknown special file or file system `/var' so match them both.
|
Revision tags: netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.88 |
|
11-Aug-2011 |
apb |
branches: 1.88.2; 1.88.4; 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.
|
#
1.87 |
|
09-Jun-2011 |
christos |
PR/42642: Ed Ravin: Handle daemons that start with #!/usr/bin/env interp
|
Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.86 |
|
26-Sep-2010 |
apb |
branches: 1.86.4; Add a collapse_backslash_newline function to rc.subr.
|
#
1.85 |
|
08-Jun-2010 |
christos |
use modulo instead of logical and. from pooka
|
#
1.84 |
|
08-Jun-2010 |
christos |
explain why this code is there.
|
#
1.83 |
|
06-Jun-2010 |
christos |
fix conditional, from dholland.
|
#
1.82 |
|
04-Jun-2010 |
christos |
print human readable exit code.
|
#
1.81 |
|
15-Mar-2010 |
jmmv |
Allow the run_rc_command function in rc.subr to pass extra parameters to the command being executed. This is to allow rc.d scripts to do:
run_rc_command "${@}"
instead of:
run_rc_command "${1}"
and let the command handler (start, stop, etc.) receive the arguments after the command name.
None of the default commands allow extra arguments, and they will error out if any are given. This is mostly useful for script-specific commands that are only supposed to be used through the command line and, therefore, need to provide a friendly interface.
Proposed in tech-userlevel@. No major objections except for some minor concerns regarding whether this should be allowed or not at all. Note that I'm not touching any of the rc.d scripts in the base system, so this is effectively a no-op from the user point of view.
|
Revision tags: matt-premerge-20091211
|
#
1.80 |
|
14-Sep-2009 |
apb |
Fix some errors in the way scripts with "KEYWORD: interactive" are handled. There was an inverted test, and "set $_args" had the wrong scope (in several nearly-identical blocks of code).
|
#
1.79 |
|
14-Sep-2009 |
apb |
Add the ability for file systems mounted via mount_critical_filesystems() in rc.subr to be marked as optional. This means that it's not an error if the file system is not mentioned in /etc/fstab. It is still an error if something else goes wrong.
Change the defaults for these two variables in /etc/defaults/rc.conf: critical_filesystems_local="OPTIONAL:/var" critical_filesystems_remote="OPTIONAL:/usr"
|
#
1.78 |
|
11-Sep-2009 |
apb |
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.
|
#
1.77 |
|
05-Sep-2009 |
apb |
Change multiple spaces to tabs on one line
|
#
1.76 |
|
10-Jul-2009 |
christos |
1. centralize the fsck error handling 2. don't check if root is on nfs 3. reboot -n if root was modified as the manual page suggests
|
Revision tags: jym-xensuspend-nbase jym-xensuspend-base
|
#
1.75 |
|
28-Apr-2009 |
reed |
Get rid of extra space in Usage statement.
|
Revision tags: mjf-devfs2-base2
|
#
1.74 |
|
06-Dec-2008 |
salo |
branches: 1.74.2; A very old patch sitting in my tree..
When rc scripts are started from interactive shell, be nice and when user tries to start an unconfigured service, point him to rc.conf(5) and tell him about the one* keyword. Also be more user friendly when an unknown argument is entered.
Example:
# /etc/rc.d/cron start $cron is not enabled - see rc.conf(5). Use the following if you wish to perform the operation: /etc/rc.d/cron onestart
# /etc/rc.d/cron nonsense /etc/rc.d/cron: unknown directive 'nonsense'. Usage: /etc/rc.d/cron [fast|force|one](start stop restart rcvar status poll)
Inspired by discussion on tech-userlevel:
http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0010.html http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0011.html http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0012.html
Reminded about it and reviewed by <lukem>
|
Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 mjf-devfs2-base
|
#
1.73 |
|
23-Jun-2008 |
dholland |
branches: 1.73.2; fix typo
|
Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
|
#
1.72 |
|
22-May-2008 |
he |
Add support for optionally setting some environment variables before starting ${command}, via ${name}_env.
Discussed with lukem.
|
Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2
|
#
1.71 |
|
30-Apr-2008 |
martin |
branches: 1.71.2; Convert TNF licenses to new 2 clause variant
|
Revision tags: yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-base mjf-devfs-base matt-armv6-nbase matt-armv6-base hpcarm-cleanup-base
|
#
1.70 |
|
31-Dec-2007 |
ad |
branches: 1.70.2; 1.70.6; 1.70.8; Remove systrace. Ok core@.
|
Revision tags: matt-armv6-prevmlocking cube-autoconf-base matt-mips64-base
|
#
1.69 |
|
06-Apr-2007 |
apb |
branches: 1.69.4; * Add a stop_boot() function in rc.subr, to terminate a multi-user boot by killing the parent process. The parent's PID is saved in $RC_PID. * In all rc.d/* scripts that previously tried to stop the boot, replace in-line code with "stop_boot". * Document this.
This should fix PR 29822.
|
#
1.68 |
|
27-Jan-2007 |
hubertf |
_find_processes(): in addition to the existing "interpreter: /path/to/daemon" also recognize "interpreter: daemon" in ps(1) output.
That case statement should be rewritten with expr(1) if more flexibility is needed.
Fixes PR 35366 by Dominik Joe Pantucek, debugged with much assistance by him on IRC.
|
Revision tags: netbsd-4-base
|
#
1.67 |
|
07-Oct-2006 |
elad |
branches: 1.67.2; PR/32004: Ed Ravin: command interpreter test in rc.subr doesn't accomodate chroots
Patch applied, thanks!
okay apb@
|
Revision tags: abandoned-netbsd-4-base
|
#
1.66 |
|
01-Apr-2006 |
he |
In order to handle some perl scripts running as daemons, add a pattern which also matches "`basename $interpreter`: $command" in the ps listing. Should fix PR#31932.
|
Revision tags: netbsd-3-0-3-RELEASE netbsd-3-0-2-RELEASE netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
|
#
1.65 |
|
12-Oct-2004 |
lukem |
branches: 1.65.2; * Implement load_rc_config_var cmd var to load the rc.conf(5) configuration for cmd and set var in the current shell, using 'load_rc_config var' in a sub-shell to avoid unwanted side-effects.
* Improve required_vars warning message.
|
#
1.64 |
|
13-Aug-2004 |
mycroft |
Add an _rc_subr_loaded variable, set to ":" by rc.subr. Scripts can use this for a speedup by doing: $_rc_subr_loaded . /etc/rc.subr
|
#
1.63 |
|
03-May-2004 |
lukem |
When performing "start", "stop" or "reload" in run_rc_command(), send any "<name> already running" or "<name> not running" messages to stderr instead of stdout before the (existing) non-zero exit.
|
#
1.62 |
|
02-Apr-2004 |
jmmv |
Introduce and use the rcvar_manpage variable, which contains the manual page name where the user should look at for documentation about rcvar. It defaults to 'rc.subr(5)', as rc.subr is mainly used by rc.d scripts.
This variable is useful to let the daily, weekly, monthly and security scripts tune the warning message shown when any of the variables they handle is not properly set.
Closes PR misc/23908.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.61 |
|
06-Jan-2004 |
lukem |
branches: 1.61.4; Implement ``one'' prefix to allow a "one shot" operation as if ${rcvar}=yes yet all the other prerequisite tests are still performed. The existing ``force'' prefix is a sledgehammer that ignores all the prerequisite checks and always returns a zero exit status; this is a more gentle approach to the problem of "manipulate this disabled service without editing rc.conf(5)".
|
#
1.60 |
|
26-Jul-2003 |
lukem |
Add "*,v" to the list of scratch files to skip. Suggested by Johnny Lam / Alistair Crooks
|
#
1.59 |
|
04-Jul-2003 |
lukem |
Revert previous; the "return" if rc.subr had already loaded had issues in some circumstances where run_rc_script()'s sourcing of an rc.d file which then sourced rc.subr, the `optimisation' in rc.subr to "return as we're already loaded" would finish more than just the inner-most sourcing. I haven't tracked down the exact issue, but removing the `optimisation' fixes the problem I noticed in starting up certain rc.d scripts, and may fix [bin/22053] as well.
|
#
1.58 |
|
27-Jun-2003 |
lukem |
If _rc_subr_loaded=true, "return" immediately, otherwise set that var and continue as normal. Gains ~ 2 seconds on 110 runs of ". rc.subr" on a shark. Suggested by Andrew Cagney in [bin/18400]
|
#
1.57 |
|
27-Jun-2003 |
lukem |
run_rc_command(): when checking if ${command} exists before executing it, be sure to check under ${name_chroot} (if set). Fix from Ed Ravin in [bin/18523]
|
#
1.56 |
|
03-Jun-2003 |
christos |
Use more concise shell syntax: 1. for i in $* -> for i 2. foo=$* -> foo="$@"
|
#
1.55 |
|
05-Jan-2003 |
lukem |
Fix logic error I introduced recently into mount_critical_filesystems(). Noted by kilbi@rad.rwth-aachen.de in [bin/19703].
|
#
1.54 |
|
05-Jan-2003 |
lukem |
'if ! command;' is not POSIX sh, even though our /bin/sh supports it
|
#
1.53 |
|
04-Jan-2003 |
lukem |
Change how internal boolean variables are used to: if ! ${_somevar:-false}; then _somevar=true fi (Consisent, slightly quicker, and slightly cleaner)
|
Revision tags: fvdl_fs64_base
|
#
1.52 |
|
26-Aug-2002 |
abs |
Append ' - see rc.conf(5)' to unset variable warning: /etc/rc.d/fu: WARNING: $fu is not set properly - see rc.conf(5). Add a note to rc.conf that third party packages may test for additional variables.
|
#
1.51 |
|
25-Jul-2002 |
grant |
add test for /usr/bin/logger in warn/err.
|
#
1.50 |
|
08-Jul-2002 |
atatat |
Add systrace(1) support to rc.subr. Most services (eg, ${name} is 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.
|
Revision tags: netbsd-1-6-base
|
#
1.49 |
|
21-May-2002 |
lukem |
branches: 1.49.2; When using backup_uses_rcs=YES in backup_file(), after checking the file 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").
|
#
1.48 |
|
18-Apr-2002 |
lukem |
consistently set rc_(fast|force)=yes
|
#
1.47 |
|
27-Mar-2002 |
lukem |
Replace $critical_filesystems_beforenet with $critical_filesystems_local . 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!
|
#
1.46 |
|
22-Mar-2002 |
lukem |
- 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].
|
#
1.45 |
|
21-Mar-2002 |
lukem |
- Add run_rc_command() control variable $command_interpreter 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.
|
#
1.44 |
|
13-Mar-2002 |
lukem |
Use ${_arg}_postcmd even if we're not using the default ${_arg}_cmd method.
|
#
1.43 |
|
13-Mar-2002 |
lukem |
Implement ${_arg}_postcmd support, which is run if a default start/stop/reload/restart operation succeeds (i.e, zero exit code). Code from Lubomir Sedlacik <salo@Xtrmntr.org>.
|
#
1.42 |
|
25-Feb-2002 |
lukem |
Fixes derived from [bin/15563] submitted by Ron Roskens: - 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.
|
#
1.41 |
|
25-Feb-2002 |
lukem |
fix spelo. crank copyright year
|
#
1.40 |
|
25-Feb-2002 |
lukem |
Don't run "status" as if "force" is set, thus reverting part of rev 1.29. 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.
|
#
1.39 |
|
25-Feb-2002 |
lukem |
run_rc_script() improvements: - 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
|
#
1.38 |
|
19-Nov-2001 |
lukem |
Add reverse_list(), which prints the reverse of the list of words. Doesn't attempt to handle words with whitespace, etc.
|
#
1.37 |
|
18-Jun-2001 |
lukem |
Improve run_rc_script(): - 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].
|
#
1.36 |
|
10-May-2001 |
atatat |
When using rcs to track backups, force the rcs archive to be unlocked, use only non-strict locking, and leave the archives unlocked after checking in changes.
|
#
1.35 |
|
09-May-2001 |
lukem |
* change wait_for_pids() to spin forever (rather than just ~ 65 seconds). * 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 ?)
|
#
1.34 |
|
07-May-2001 |
lukem |
Don't try and use single quotes in the RHS of a ${ :+ } expansion 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.
|
#
1.33 |
|
18-Apr-2001 |
lukem |
* provide wait_for_pids(), which spins until all the given pids don't exist * 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.
|
#
1.32 |
|
06-Apr-2001 |
lukem |
clarify that ${name}_groups is comma separated
|
#
1.31 |
|
04-Apr-2001 |
atatat |
Provide the capability of storing backups via RCS instead of just a "current" and a "last" (which is useless if you wanna know what you changed last week). Set the default to on.
|
#
1.30 |
|
28-Feb-2001 |
lukem |
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
|
#
1.29 |
|
17-Nov-2000 |
lukem |
* always run `status'; i.e, ignore the setting of $rcvar just like `rcvar' does. * 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.
|
#
1.28 |
|
06-Nov-2000 |
lukem |
when doing `status', return non-zero if the program isn't running. request by thorpej.
|
#
1.27 |
|
05-Nov-2000 |
lukem |
when running `forcerestart', call the underlying `stop' and `start' with the `force' prefix as well
|
#
1.26 |
|
07-Oct-2000 |
lukem |
use ${foo##*/} instead of `basename $foo`. as suggested (with minor variation) by Toru Nishimura <nisimura@itc.aist-nara.ac.jp>
|
#
1.25 |
|
01-Oct-2000 |
lukem |
remove unnecessary leading `$' on warnings printed for $required_dirs and $required_files.
|
#
1.24 |
|
19-Sep-2000 |
lukem |
- only perform the checkyesno on the variable named in $rcvar (rather than 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
|
#
1.23 |
|
19-Aug-2000 |
lukem |
support ${name}_nice even when using ${name}_chroot. per discussion with mrg...
|
#
1.22 |
|
17-Aug-2000 |
lukem |
add support for ${name}_chroot, which chroot(8)s before running the command. 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 :-]
|
#
1.21 |
|
20-Jul-2000 |
lukem |
in err() and warn() put a : between the ERROR/WARNING label and the message
|
Revision tags: netbsd-1-5-base
|
#
1.20 |
|
09-Jun-2000 |
fvdl |
branches: 1.20.2; Add and rc.conf.d directory. If a config file for command X exists (/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
|
Revision tags: minoura-xpg4dl-base
|
#
1.19 |
|
13-May-2000 |
lukem |
branches: 1.19.2; Implement load_rc_config(), which takes the config name as an argument. 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/*.
|
#
1.18 |
|
13-May-2000 |
lukem |
implement three new variables for run_rc_command: - ${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 :)
|
#
1.17 |
|
30-Apr-2000 |
lukem |
- prefix some more local variables with `_' (when you have a convention, stick to it :-) - simplify run_rc_script (no need to support fast* or force* here...) - clarify some comments
|
#
1.16 |
|
30-Apr-2000 |
lukem |
change run_rc_command() to take the list of extra commands supported 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.
|
#
1.15 |
|
28-Apr-2000 |
lukem |
in check_pidfile and check_process, also match "(" + `basename prog` + ")" . noted by veego@
|
#
1.14 |
|
26-Apr-2000 |
lukem |
don't bother checking rc_configured each time run_rc_command executes; once in /etc/rc is enough
|
#
1.13 |
|
22-Apr-2000 |
lukem |
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).
|
#
1.12 |
|
19-Apr-2000 |
simonb |
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.
|
#
1.11 |
|
10-Mar-2000 |
lukem |
* add: 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
|
Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
|
#
1.10 |
|
07-Jul-1999 |
drochner |
repair diskless startup: "netstart" needs "sysctl" and "awk" now, thus "/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...
|
#
1.9 |
|
28-Apr-1999 |
nathanw |
Move the knowledge that /usr and /var should be mounted early from 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.
|
#
1.8 |
|
13-Apr-1999 |
cjs |
When checking local status, jJust ignore not-found filesystems, rather than printing an error, just as we do when we try to mount it.
|
Revision tags: netbsd-1-4-base
|
#
1.7 |
|
01-Apr-1999 |
cjs |
branches: 1.7.2; 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.
|
#
1.6 |
|
24-Mar-1999 |
mellon |
- Move critical filesystem mounting code into a shell function and put that in rc.subr. - Support critfs_require_network rc.conf variable.
|
#
1.5 |
|
28-Feb-1998 |
lukem |
improve description comment
|
#
1.4 |
|
28-Feb-1998 |
lukem |
* add synonyms for "yes": "true", "on", and "1" * add synonyms for "no": "false", "off", and "0" * remove unnecessary trailing semicolons (this is sh, not C)
|
#
1.3 |
|
26-Jan-1998 |
lukem |
convert 'if .. else .. fi' into a 'case .. esac', and allow for any uppercase/lowercase variations of 'yes' and 'no'. fixes [misc/4887] sent in by "John F. Woods" <jfw@jfwhome.funhouse.com>
|
Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
|
#
1.2 |
|
30-Aug-1997 |
cjs |
Prune unused function.
|
#
1.1 |
|
29-Aug-1997 |
cjs |
Split rc.conf variables for starting programs into two: an on/off 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.
|
Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
|
#
1.100 |
|
13-Apr-2017 |
christos |
remove env.
|
#
1.99 |
|
21-Mar-2017 |
christos |
Clear rc variables that contain state that is gone after the boot process is complete, so that scripts invoked from powerd don't think that they are still invoked by the rc system and fail. Reported by rudolf @ tech-userlevel
|
Revision tags: pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
|
#
1.98 |
|
06-Mar-2016 |
christos |
branches: 1.98.2; 1.98.4; Introduce kat() a built-in version of cat(1) that strips shell-like comments.
|
#
1.97 |
|
31-Oct-2015 |
phx |
PR misc/50046 Remove the expensive tests in _have_rc_postprocessor(), as proposed by apb@. It more than halves the multiuser boot time on slow machines and brings it back near to the previous level.
|
#
1.96 |
|
07-Oct-2014 |
roy |
sleep for 0.05 seconds instead of 2 seconds when checking if the pids are still alive for a much faster exit.
|
#
1.95 |
|
21-Sep-2014 |
roy |
Add checkyesnox function so we can test a configurable without being warned of its non-existance.
|
Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
|
#
1.94 |
|
27-Jul-2014 |
apb |
branches: 1.94.2; 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.
|
#
1.93 |
|
22-Jul-2014 |
wiz |
'file system' for consistency with documentation (instead of 'filesystem').
|
Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
|
#
1.92 |
|
17-Dec-2012 |
apb |
branches: 1.92.8; Add shell implementations of basename and dirname to rc.subr. They are supposed to mimic basename(1) and dirname(1), except that they are usable before /usr/bin is mounted.
|
Revision tags: yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
|
#
1.91 |
|
07-Apr-2012 |
christos |
branches: 1.91.2; back out change that makes onestart work, to be committed at some other time.
|
#
1.90 |
|
07-Apr-2012 |
christos |
give wedges to everyone
|
#
1.89 |
|
07-Apr-2012 |
apb |
The error message when /var is not a file system chhanged from mount: unknown special file or file system `/var' to mount: Unknown special file or file system `/var' so match them both.
|
Revision tags: netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.88 |
|
11-Aug-2011 |
apb |
branches: 1.88.2; 1.88.4; 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.
|
#
1.87 |
|
09-Jun-2011 |
christos |
PR/42642: Ed Ravin: Handle daemons that start with #!/usr/bin/env interp
|
Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.86 |
|
26-Sep-2010 |
apb |
branches: 1.86.4; Add a collapse_backslash_newline function to rc.subr.
|
#
1.85 |
|
08-Jun-2010 |
christos |
use modulo instead of logical and. from pooka
|
#
1.84 |
|
08-Jun-2010 |
christos |
explain why this code is there.
|
#
1.83 |
|
06-Jun-2010 |
christos |
fix conditional, from dholland.
|
#
1.82 |
|
04-Jun-2010 |
christos |
print human readable exit code.
|
#
1.81 |
|
15-Mar-2010 |
jmmv |
Allow the run_rc_command function in rc.subr to pass extra parameters to the command being executed. This is to allow rc.d scripts to do:
run_rc_command "${@}"
instead of:
run_rc_command "${1}"
and let the command handler (start, stop, etc.) receive the arguments after the command name.
None of the default commands allow extra arguments, and they will error out if any are given. This is mostly useful for script-specific commands that are only supposed to be used through the command line and, therefore, need to provide a friendly interface.
Proposed in tech-userlevel@. No major objections except for some minor concerns regarding whether this should be allowed or not at all. Note that I'm not touching any of the rc.d scripts in the base system, so this is effectively a no-op from the user point of view.
|
Revision tags: matt-premerge-20091211
|
#
1.80 |
|
14-Sep-2009 |
apb |
Fix some errors in the way scripts with "KEYWORD: interactive" are handled. There was an inverted test, and "set $_args" had the wrong scope (in several nearly-identical blocks of code).
|
#
1.79 |
|
14-Sep-2009 |
apb |
Add the ability for file systems mounted via mount_critical_filesystems() in rc.subr to be marked as optional. This means that it's not an error if the file system is not mentioned in /etc/fstab. It is still an error if something else goes wrong.
Change the defaults for these two variables in /etc/defaults/rc.conf: critical_filesystems_local="OPTIONAL:/var" critical_filesystems_remote="OPTIONAL:/usr"
|
#
1.78 |
|
11-Sep-2009 |
apb |
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.
|
#
1.77 |
|
05-Sep-2009 |
apb |
Change multiple spaces to tabs on one line
|
#
1.76 |
|
10-Jul-2009 |
christos |
1. centralize the fsck error handling 2. don't check if root is on nfs 3. reboot -n if root was modified as the manual page suggests
|
Revision tags: jym-xensuspend-nbase jym-xensuspend-base
|
#
1.75 |
|
28-Apr-2009 |
reed |
Get rid of extra space in Usage statement.
|
Revision tags: mjf-devfs2-base2
|
#
1.74 |
|
06-Dec-2008 |
salo |
branches: 1.74.2; A very old patch sitting in my tree..
When rc scripts are started from interactive shell, be nice and when user tries to start an unconfigured service, point him to rc.conf(5) and tell him about the one* keyword. Also be more user friendly when an unknown argument is entered.
Example:
# /etc/rc.d/cron start $cron is not enabled - see rc.conf(5). Use the following if you wish to perform the operation: /etc/rc.d/cron onestart
# /etc/rc.d/cron nonsense /etc/rc.d/cron: unknown directive 'nonsense'. Usage: /etc/rc.d/cron [fast|force|one](start stop restart rcvar status poll)
Inspired by discussion on tech-userlevel:
http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0010.html http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0011.html http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0012.html
Reminded about it and reviewed by <lukem>
|
Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 mjf-devfs2-base
|
#
1.73 |
|
23-Jun-2008 |
dholland |
branches: 1.73.2; fix typo
|
Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
|
#
1.72 |
|
22-May-2008 |
he |
Add support for optionally setting some environment variables before starting ${command}, via ${name}_env.
Discussed with lukem.
|
Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2
|
#
1.71 |
|
30-Apr-2008 |
martin |
branches: 1.71.2; Convert TNF licenses to new 2 clause variant
|
Revision tags: yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-base mjf-devfs-base matt-armv6-nbase matt-armv6-base hpcarm-cleanup-base
|
#
1.70 |
|
31-Dec-2007 |
ad |
branches: 1.70.2; 1.70.6; 1.70.8; Remove systrace. Ok core@.
|
Revision tags: matt-armv6-prevmlocking cube-autoconf-base matt-mips64-base
|
#
1.69 |
|
06-Apr-2007 |
apb |
branches: 1.69.4; * Add a stop_boot() function in rc.subr, to terminate a multi-user boot by killing the parent process. The parent's PID is saved in $RC_PID. * In all rc.d/* scripts that previously tried to stop the boot, replace in-line code with "stop_boot". * Document this.
This should fix PR 29822.
|
#
1.68 |
|
27-Jan-2007 |
hubertf |
_find_processes(): in addition to the existing "interpreter: /path/to/daemon" also recognize "interpreter: daemon" in ps(1) output.
That case statement should be rewritten with expr(1) if more flexibility is needed.
Fixes PR 35366 by Dominik Joe Pantucek, debugged with much assistance by him on IRC.
|
Revision tags: netbsd-4-base
|
#
1.67 |
|
07-Oct-2006 |
elad |
branches: 1.67.2; PR/32004: Ed Ravin: command interpreter test in rc.subr doesn't accomodate chroots
Patch applied, thanks!
okay apb@
|
Revision tags: abandoned-netbsd-4-base
|
#
1.66 |
|
01-Apr-2006 |
he |
In order to handle some perl scripts running as daemons, add a pattern which also matches "`basename $interpreter`: $command" in the ps listing. Should fix PR#31932.
|
Revision tags: netbsd-3-0-3-RELEASE netbsd-3-0-2-RELEASE netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
|
#
1.65 |
|
12-Oct-2004 |
lukem |
branches: 1.65.2; * Implement load_rc_config_var cmd var to load the rc.conf(5) configuration for cmd and set var in the current shell, using 'load_rc_config var' in a sub-shell to avoid unwanted side-effects.
* Improve required_vars warning message.
|
#
1.64 |
|
13-Aug-2004 |
mycroft |
Add an _rc_subr_loaded variable, set to ":" by rc.subr. Scripts can use this for a speedup by doing: $_rc_subr_loaded . /etc/rc.subr
|
#
1.63 |
|
03-May-2004 |
lukem |
When performing "start", "stop" or "reload" in run_rc_command(), send any "<name> already running" or "<name> not running" messages to stderr instead of stdout before the (existing) non-zero exit.
|
#
1.62 |
|
02-Apr-2004 |
jmmv |
Introduce and use the rcvar_manpage variable, which contains the manual page name where the user should look at for documentation about rcvar. It defaults to 'rc.subr(5)', as rc.subr is mainly used by rc.d scripts.
This variable is useful to let the daily, weekly, monthly and security scripts tune the warning message shown when any of the variables they handle is not properly set.
Closes PR misc/23908.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.61 |
|
06-Jan-2004 |
lukem |
branches: 1.61.4; Implement ``one'' prefix to allow a "one shot" operation as if ${rcvar}=yes yet all the other prerequisite tests are still performed. The existing ``force'' prefix is a sledgehammer that ignores all the prerequisite checks and always returns a zero exit status; this is a more gentle approach to the problem of "manipulate this disabled service without editing rc.conf(5)".
|
#
1.60 |
|
26-Jul-2003 |
lukem |
Add "*,v" to the list of scratch files to skip. Suggested by Johnny Lam / Alistair Crooks
|
#
1.59 |
|
04-Jul-2003 |
lukem |
Revert previous; the "return" if rc.subr had already loaded had issues in some circumstances where run_rc_script()'s sourcing of an rc.d file which then sourced rc.subr, the `optimisation' in rc.subr to "return as we're already loaded" would finish more than just the inner-most sourcing. I haven't tracked down the exact issue, but removing the `optimisation' fixes the problem I noticed in starting up certain rc.d scripts, and may fix [bin/22053] as well.
|
#
1.58 |
|
27-Jun-2003 |
lukem |
If _rc_subr_loaded=true, "return" immediately, otherwise set that var and continue as normal. Gains ~ 2 seconds on 110 runs of ". rc.subr" on a shark. Suggested by Andrew Cagney in [bin/18400]
|
#
1.57 |
|
27-Jun-2003 |
lukem |
run_rc_command(): when checking if ${command} exists before executing it, be sure to check under ${name_chroot} (if set). Fix from Ed Ravin in [bin/18523]
|
#
1.56 |
|
03-Jun-2003 |
christos |
Use more concise shell syntax: 1. for i in $* -> for i 2. foo=$* -> foo="$@"
|
#
1.55 |
|
05-Jan-2003 |
lukem |
Fix logic error I introduced recently into mount_critical_filesystems(). Noted by kilbi@rad.rwth-aachen.de in [bin/19703].
|
#
1.54 |
|
05-Jan-2003 |
lukem |
'if ! command;' is not POSIX sh, even though our /bin/sh supports it
|
#
1.53 |
|
04-Jan-2003 |
lukem |
Change how internal boolean variables are used to: if ! ${_somevar:-false}; then _somevar=true fi (Consisent, slightly quicker, and slightly cleaner)
|
Revision tags: fvdl_fs64_base
|
#
1.52 |
|
26-Aug-2002 |
abs |
Append ' - see rc.conf(5)' to unset variable warning: /etc/rc.d/fu: WARNING: $fu is not set properly - see rc.conf(5). Add a note to rc.conf that third party packages may test for additional variables.
|
#
1.51 |
|
25-Jul-2002 |
grant |
add test for /usr/bin/logger in warn/err.
|
#
1.50 |
|
08-Jul-2002 |
atatat |
Add systrace(1) support to rc.subr. Most services (eg, ${name} is 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.
|
Revision tags: netbsd-1-6-base
|
#
1.49 |
|
21-May-2002 |
lukem |
branches: 1.49.2; When using backup_uses_rcs=YES in backup_file(), after checking the file 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").
|
#
1.48 |
|
18-Apr-2002 |
lukem |
consistently set rc_(fast|force)=yes
|
#
1.47 |
|
27-Mar-2002 |
lukem |
Replace $critical_filesystems_beforenet with $critical_filesystems_local . 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!
|
#
1.46 |
|
22-Mar-2002 |
lukem |
- 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].
|
#
1.45 |
|
21-Mar-2002 |
lukem |
- Add run_rc_command() control variable $command_interpreter 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.
|
#
1.44 |
|
13-Mar-2002 |
lukem |
Use ${_arg}_postcmd even if we're not using the default ${_arg}_cmd method.
|
#
1.43 |
|
13-Mar-2002 |
lukem |
Implement ${_arg}_postcmd support, which is run if a default start/stop/reload/restart operation succeeds (i.e, zero exit code). Code from Lubomir Sedlacik <salo@Xtrmntr.org>.
|
#
1.42 |
|
25-Feb-2002 |
lukem |
Fixes derived from [bin/15563] submitted by Ron Roskens: - 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.
|
#
1.41 |
|
25-Feb-2002 |
lukem |
fix spelo. crank copyright year
|
#
1.40 |
|
25-Feb-2002 |
lukem |
Don't run "status" as if "force" is set, thus reverting part of rev 1.29. 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.
|
#
1.39 |
|
25-Feb-2002 |
lukem |
run_rc_script() improvements: - 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
|
#
1.38 |
|
19-Nov-2001 |
lukem |
Add reverse_list(), which prints the reverse of the list of words. Doesn't attempt to handle words with whitespace, etc.
|
#
1.37 |
|
18-Jun-2001 |
lukem |
Improve run_rc_script(): - 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].
|
#
1.36 |
|
10-May-2001 |
atatat |
When using rcs to track backups, force the rcs archive to be unlocked, use only non-strict locking, and leave the archives unlocked after checking in changes.
|
#
1.35 |
|
09-May-2001 |
lukem |
* change wait_for_pids() to spin forever (rather than just ~ 65 seconds). * 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 ?)
|
#
1.34 |
|
07-May-2001 |
lukem |
Don't try and use single quotes in the RHS of a ${ :+ } expansion 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.
|
#
1.33 |
|
18-Apr-2001 |
lukem |
* provide wait_for_pids(), which spins until all the given pids don't exist * 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.
|
#
1.32 |
|
06-Apr-2001 |
lukem |
clarify that ${name}_groups is comma separated
|
#
1.31 |
|
04-Apr-2001 |
atatat |
Provide the capability of storing backups via RCS instead of just a "current" and a "last" (which is useless if you wanna know what you changed last week). Set the default to on.
|
#
1.30 |
|
28-Feb-2001 |
lukem |
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
|
#
1.29 |
|
17-Nov-2000 |
lukem |
* always run `status'; i.e, ignore the setting of $rcvar just like `rcvar' does. * 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.
|
#
1.28 |
|
06-Nov-2000 |
lukem |
when doing `status', return non-zero if the program isn't running. request by thorpej.
|
#
1.27 |
|
05-Nov-2000 |
lukem |
when running `forcerestart', call the underlying `stop' and `start' with the `force' prefix as well
|
#
1.26 |
|
07-Oct-2000 |
lukem |
use ${foo##*/} instead of `basename $foo`. as suggested (with minor variation) by Toru Nishimura <nisimura@itc.aist-nara.ac.jp>
|
#
1.25 |
|
01-Oct-2000 |
lukem |
remove unnecessary leading `$' on warnings printed for $required_dirs and $required_files.
|
#
1.24 |
|
19-Sep-2000 |
lukem |
- only perform the checkyesno on the variable named in $rcvar (rather than 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
|
#
1.23 |
|
19-Aug-2000 |
lukem |
support ${name}_nice even when using ${name}_chroot. per discussion with mrg...
|
#
1.22 |
|
17-Aug-2000 |
lukem |
add support for ${name}_chroot, which chroot(8)s before running the command. 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 :-]
|
#
1.21 |
|
20-Jul-2000 |
lukem |
in err() and warn() put a : between the ERROR/WARNING label and the message
|
Revision tags: netbsd-1-5-base
|
#
1.20 |
|
09-Jun-2000 |
fvdl |
branches: 1.20.2; Add and rc.conf.d directory. If a config file for command X exists (/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
|
Revision tags: minoura-xpg4dl-base
|
#
1.19 |
|
13-May-2000 |
lukem |
branches: 1.19.2; Implement load_rc_config(), which takes the config name as an argument. 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/*.
|
#
1.18 |
|
13-May-2000 |
lukem |
implement three new variables for run_rc_command: - ${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 :)
|
#
1.17 |
|
30-Apr-2000 |
lukem |
- prefix some more local variables with `_' (when you have a convention, stick to it :-) - simplify run_rc_script (no need to support fast* or force* here...) - clarify some comments
|
#
1.16 |
|
30-Apr-2000 |
lukem |
change run_rc_command() to take the list of extra commands supported 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.
|
#
1.15 |
|
28-Apr-2000 |
lukem |
in check_pidfile and check_process, also match "(" + `basename prog` + ")" . noted by veego@
|
#
1.14 |
|
26-Apr-2000 |
lukem |
don't bother checking rc_configured each time run_rc_command executes; once in /etc/rc is enough
|
#
1.13 |
|
22-Apr-2000 |
lukem |
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).
|
#
1.12 |
|
19-Apr-2000 |
simonb |
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.
|
#
1.11 |
|
10-Mar-2000 |
lukem |
* add: 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
|
Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
|
#
1.10 |
|
07-Jul-1999 |
drochner |
repair diskless startup: "netstart" needs "sysctl" and "awk" now, thus "/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...
|
#
1.9 |
|
28-Apr-1999 |
nathanw |
Move the knowledge that /usr and /var should be mounted early from 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.
|
#
1.8 |
|
13-Apr-1999 |
cjs |
When checking local status, jJust ignore not-found filesystems, rather than printing an error, just as we do when we try to mount it.
|
Revision tags: netbsd-1-4-base
|
#
1.7 |
|
01-Apr-1999 |
cjs |
branches: 1.7.2; 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.
|
#
1.6 |
|
24-Mar-1999 |
mellon |
- Move critical filesystem mounting code into a shell function and put that in rc.subr. - Support critfs_require_network rc.conf variable.
|
#
1.5 |
|
28-Feb-1998 |
lukem |
improve description comment
|
#
1.4 |
|
28-Feb-1998 |
lukem |
* add synonyms for "yes": "true", "on", and "1" * add synonyms for "no": "false", "off", and "0" * remove unnecessary trailing semicolons (this is sh, not C)
|
#
1.3 |
|
26-Jan-1998 |
lukem |
convert 'if .. else .. fi' into a 'case .. esac', and allow for any uppercase/lowercase variations of 'yes' and 'no'. fixes [misc/4887] sent in by "John F. Woods" <jfw@jfwhome.funhouse.com>
|
Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
|
#
1.2 |
|
30-Aug-1997 |
cjs |
Prune unused function.
|
#
1.1 |
|
29-Aug-1997 |
cjs |
Split rc.conf variables for starting programs into two: an on/off 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.
|
Revision tags: pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
|
#
1.98 |
|
06-Mar-2016 |
christos |
Introduce kat() a built-in version of cat(1) that strips shell-like comments.
|
#
1.97 |
|
30-Oct-2015 |
phx |
PR misc/50046 Remove the expensive tests in _have_rc_postprocessor(), as proposed by apb@. It more than halves the multiuser boot time on slow machines and brings it back near to the previous level.
|
#
1.96 |
|
07-Oct-2014 |
roy |
sleep for 0.05 seconds instead of 2 seconds when checking if the pids are still alive for a much faster exit.
|
#
1.95 |
|
21-Sep-2014 |
roy |
Add checkyesnox function so we can test a configurable without being warned of its non-existance.
|
Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
|
#
1.94 |
|
27-Jul-2014 |
apb |
branches: 1.94.2; 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.
|
#
1.93 |
|
22-Jul-2014 |
wiz |
'file system' for consistency with documentation (instead of 'filesystem').
|
Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
|
#
1.92 |
|
17-Dec-2012 |
apb |
branches: 1.92.8; Add shell implementations of basename and dirname to rc.subr. They are supposed to mimic basename(1) and dirname(1), except that they are usable before /usr/bin is mounted.
|
Revision tags: yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
|
#
1.91 |
|
07-Apr-2012 |
christos |
branches: 1.91.2; back out change that makes onestart work, to be committed at some other time.
|
#
1.90 |
|
07-Apr-2012 |
christos |
give wedges to everyone
|
#
1.89 |
|
07-Apr-2012 |
apb |
The error message when /var is not a file system chhanged from mount: unknown special file or file system `/var' to mount: Unknown special file or file system `/var' so match them both.
|
Revision tags: netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
|
#
1.88 |
|
11-Aug-2011 |
apb |
branches: 1.88.2; 1.88.4; 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.
|
#
1.87 |
|
09-Jun-2011 |
christos |
PR/42642: Ed Ravin: Handle daemons that start with #!/usr/bin/env interp
|
Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.86 |
|
26-Sep-2010 |
apb |
branches: 1.86.4; Add a collapse_backslash_newline function to rc.subr.
|
#
1.85 |
|
08-Jun-2010 |
christos |
use modulo instead of logical and. from pooka
|
#
1.84 |
|
08-Jun-2010 |
christos |
explain why this code is there.
|
#
1.83 |
|
05-Jun-2010 |
christos |
fix conditional, from dholland.
|
#
1.82 |
|
04-Jun-2010 |
christos |
print human readable exit code.
|
#
1.81 |
|
15-Mar-2010 |
jmmv |
Allow the run_rc_command function in rc.subr to pass extra parameters to the command being executed. This is to allow rc.d scripts to do:
run_rc_command "${@}"
instead of:
run_rc_command "${1}"
and let the command handler (start, stop, etc.) receive the arguments after the command name.
None of the default commands allow extra arguments, and they will error out if any are given. This is mostly useful for script-specific commands that are only supposed to be used through the command line and, therefore, need to provide a friendly interface.
Proposed in tech-userlevel@. No major objections except for some minor concerns regarding whether this should be allowed or not at all. Note that I'm not touching any of the rc.d scripts in the base system, so this is effectively a no-op from the user point of view.
|
Revision tags: matt-premerge-20091211
|
#
1.80 |
|
14-Sep-2009 |
apb |
Fix some errors in the way scripts with "KEYWORD: interactive" are handled. There was an inverted test, and "set $_args" had the wrong scope (in several nearly-identical blocks of code).
|
#
1.79 |
|
13-Sep-2009 |
apb |
Add the ability for file systems mounted via mount_critical_filesystems() in rc.subr to be marked as optional. This means that it's not an error if the file system is not mentioned in /etc/fstab. It is still an error if something else goes wrong.
Change the defaults for these two variables in /etc/defaults/rc.conf: critical_filesystems_local="OPTIONAL:/var" critical_filesystems_remote="OPTIONAL:/usr"
|
#
1.78 |
|
11-Sep-2009 |
apb |
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.
|
#
1.77 |
|
05-Sep-2009 |
apb |
Change multiple spaces to tabs on one line
|
#
1.76 |
|
10-Jul-2009 |
christos |
1. centralize the fsck error handling 2. don't check if root is on nfs 3. reboot -n if root was modified as the manual page suggests
|
Revision tags: jym-xensuspend-nbase jym-xensuspend-base
|
#
1.75 |
|
27-Apr-2009 |
reed |
Get rid of extra space in Usage statement.
|
Revision tags: mjf-devfs2-base2
|
#
1.74 |
|
06-Dec-2008 |
salo |
branches: 1.74.2; A very old patch sitting in my tree..
When rc scripts are started from interactive shell, be nice and when user tries to start an unconfigured service, point him to rc.conf(5) and tell him about the one* keyword. Also be more user friendly when an unknown argument is entered.
Example:
# /etc/rc.d/cron start $cron is not enabled - see rc.conf(5). Use the following if you wish to perform the operation: /etc/rc.d/cron onestart
# /etc/rc.d/cron nonsense /etc/rc.d/cron: unknown directive 'nonsense'. Usage: /etc/rc.d/cron [fast|force|one](start stop restart rcvar status poll)
Inspired by discussion on tech-userlevel:
http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0010.html http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0011.html http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0012.html
Reminded about it and reviewed by <lukem>
|
Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 mjf-devfs2-base
|
#
1.73 |
|
22-Jun-2008 |
dholland |
branches: 1.73.2; fix typo
|
Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
|
#
1.72 |
|
22-May-2008 |
he |
Add support for optionally setting some environment variables before starting ${command}, via ${name}_env.
Discussed with lukem.
|
Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2
|
#
1.71 |
|
30-Apr-2008 |
martin |
branches: 1.71.2; Convert TNF licenses to new 2 clause variant
|
Revision tags: yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-base mjf-devfs-base matt-armv6-nbase matt-armv6-base hpcarm-cleanup-base
|
#
1.70 |
|
31-Dec-2007 |
ad |
branches: 1.70.2; 1.70.6; 1.70.8; Remove systrace. Ok core@.
|
Revision tags: matt-armv6-prevmlocking cube-autoconf-base matt-mips64-base
|
#
1.69 |
|
06-Apr-2007 |
apb |
branches: 1.69.4; * Add a stop_boot() function in rc.subr, to terminate a multi-user boot by killing the parent process. The parent's PID is saved in $RC_PID. * In all rc.d/* scripts that previously tried to stop the boot, replace in-line code with "stop_boot". * Document this.
This should fix PR 29822.
|
#
1.68 |
|
27-Jan-2007 |
hubertf |
_find_processes(): in addition to the existing "interpreter: /path/to/daemon" also recognize "interpreter: daemon" in ps(1) output.
That case statement should be rewritten with expr(1) if more flexibility is needed.
Fixes PR 35366 by Dominik Joe Pantucek, debugged with much assistance by him on IRC.
|
Revision tags: netbsd-4-base
|
#
1.67 |
|
07-Oct-2006 |
elad |
branches: 1.67.2; PR/32004: Ed Ravin: command interpreter test in rc.subr doesn't accomodate chroots
Patch applied, thanks!
okay apb@
|
Revision tags: abandoned-netbsd-4-base
|
#
1.66 |
|
01-Apr-2006 |
he |
In order to handle some perl scripts running as daemons, add a pattern which also matches "`basename $interpreter`: $command" in the ps listing. Should fix PR#31932.
|
Revision tags: netbsd-3-0-3-RELEASE netbsd-3-0-2-RELEASE netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
|
#
1.65 |
|
12-Oct-2004 |
lukem |
branches: 1.65.2; * Implement load_rc_config_var cmd var to load the rc.conf(5) configuration for cmd and set var in the current shell, using 'load_rc_config var' in a sub-shell to avoid unwanted side-effects.
* Improve required_vars warning message.
|
#
1.64 |
|
13-Aug-2004 |
mycroft |
Add an _rc_subr_loaded variable, set to ":" by rc.subr. Scripts can use this for a speedup by doing: $_rc_subr_loaded . /etc/rc.subr
|
#
1.63 |
|
03-May-2004 |
lukem |
When performing "start", "stop" or "reload" in run_rc_command(), send any "<name> already running" or "<name> not running" messages to stderr instead of stdout before the (existing) non-zero exit.
|
#
1.62 |
|
02-Apr-2004 |
jmmv |
Introduce and use the rcvar_manpage variable, which contains the manual page name where the user should look at for documentation about rcvar. It defaults to 'rc.subr(5)', as rc.subr is mainly used by rc.d scripts.
This variable is useful to let the daily, weekly, monthly and security scripts tune the warning message shown when any of the variables they handle is not properly set.
Closes PR misc/23908.
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
#
1.61 |
|
05-Jan-2004 |
lukem |
branches: 1.61.4; Implement ``one'' prefix to allow a "one shot" operation as if ${rcvar}=yes yet all the other prerequisite tests are still performed. The existing ``force'' prefix is a sledgehammer that ignores all the prerequisite checks and always returns a zero exit status; this is a more gentle approach to the problem of "manipulate this disabled service without editing rc.conf(5)".
|
#
1.60 |
|
25-Jul-2003 |
lukem |
Add "*,v" to the list of scratch files to skip. Suggested by Johnny Lam / Alistair Crooks
|
#
1.59 |
|
04-Jul-2003 |
lukem |
Revert previous; the "return" if rc.subr had already loaded had issues in some circumstances where run_rc_script()'s sourcing of an rc.d file which then sourced rc.subr, the `optimisation' in rc.subr to "return as we're already loaded" would finish more than just the inner-most sourcing. I haven't tracked down the exact issue, but removing the `optimisation' fixes the problem I noticed in starting up certain rc.d scripts, and may fix [bin/22053] as well.
|
#
1.58 |
|
26-Jun-2003 |
lukem |
If _rc_subr_loaded=true, "return" immediately, otherwise set that var and continue as normal. Gains ~ 2 seconds on 110 runs of ". rc.subr" on a shark. Suggested by Andrew Cagney in [bin/18400]
|
#
1.57 |
|
26-Jun-2003 |
lukem |
run_rc_command(): when checking if ${command} exists before executing it, be sure to check under ${name_chroot} (if set). Fix from Ed Ravin in [bin/18523]
|
#
1.56 |
|
03-Jun-2003 |
christos |
Use more concise shell syntax: 1. for i in $* -> for i 2. foo=$* -> foo="$@"
|
#
1.55 |
|
05-Jan-2003 |
lukem |
Fix logic error I introduced recently into mount_critical_filesystems(). Noted by kilbi@rad.rwth-aachen.de in [bin/19703].
|
#
1.54 |
|
05-Jan-2003 |
lukem |
'if ! command;' is not POSIX sh, even though our /bin/sh supports it
|
#
1.53 |
|
04-Jan-2003 |
lukem |
Change how internal boolean variables are used to: if ! ${_somevar:-false}; then _somevar=true fi (Consisent, slightly quicker, and slightly cleaner)
|
Revision tags: fvdl_fs64_base
|
#
1.52 |
|
26-Aug-2002 |
abs |
Append ' - see rc.conf(5)' to unset variable warning: /etc/rc.d/fu: WARNING: $fu is not set properly - see rc.conf(5). Add a note to rc.conf that third party packages may test for additional variables.
|
#
1.51 |
|
25-Jul-2002 |
grant |
add test for /usr/bin/logger in warn/err.
|
#
1.50 |
|
08-Jul-2002 |
atatat |
Add systrace(1) support to rc.subr. Most services (eg, ${name} is 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.
|
Revision tags: netbsd-1-6-base
|
#
1.49 |
|
20-May-2002 |
lukem |
branches: 1.49.2; When using backup_uses_rcs=YES in backup_file(), after checking the file 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").
|
#
1.48 |
|
18-Apr-2002 |
lukem |
consistently set rc_(fast|force)=yes
|
#
1.47 |
|
27-Mar-2002 |
lukem |
Replace $critical_filesystems_beforenet with $critical_filesystems_local . 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!
|
#
1.46 |
|
21-Mar-2002 |
lukem |
- 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].
|
#
1.45 |
|
20-Mar-2002 |
lukem |
- Add run_rc_command() control variable $command_interpreter 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.
|
#
1.44 |
|
12-Mar-2002 |
lukem |
Use ${_arg}_postcmd even if we're not using the default ${_arg}_cmd method.
|
#
1.43 |
|
12-Mar-2002 |
lukem |
Implement ${_arg}_postcmd support, which is run if a default start/stop/reload/restart operation succeeds (i.e, zero exit code). Code from Lubomir Sedlacik <salo@Xtrmntr.org>.
|
#
1.42 |
|
24-Feb-2002 |
lukem |
Fixes derived from [bin/15563] submitted by Ron Roskens: - 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.
|
#
1.41 |
|
25-Feb-2002 |
lukem |
fix spelo. crank copyright year
|
#
1.40 |
|
25-Feb-2002 |
lukem |
Don't run "status" as if "force" is set, thus reverting part of rev 1.29. 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.
|
#
1.39 |
|
24-Feb-2002 |
lukem |
run_rc_script() improvements: - 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
|
#
1.38 |
|
18-Nov-2001 |
lukem |
Add reverse_list(), which prints the reverse of the list of words. Doesn't attempt to handle words with whitespace, etc.
|
#
1.37 |
|
18-Jun-2001 |
lukem |
Improve run_rc_script(): - 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].
|
#
1.36 |
|
10-May-2001 |
atatat |
When using rcs to track backups, force the rcs archive to be unlocked, use only non-strict locking, and leave the archives unlocked after checking in changes.
|
#
1.35 |
|
09-May-2001 |
lukem |
* change wait_for_pids() to spin forever (rather than just ~ 65 seconds). * 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 ?)
|
#
1.34 |
|
07-May-2001 |
lukem |
Don't try and use single quotes in the RHS of a ${ :+ } expansion 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.
|
#
1.33 |
|
17-Apr-2001 |
lukem |
* provide wait_for_pids(), which spins until all the given pids don't exist * 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.
|
#
1.32 |
|
06-Apr-2001 |
lukem |
clarify that ${name}_groups is comma separated
|
#
1.31 |
|
03-Apr-2001 |
atatat |
Provide the capability of storing backups via RCS instead of just a "current" and a "last" (which is useless if you wanna know what you changed last week). Set the default to on.
|
#
1.30 |
|
28-Feb-2001 |
lukem |
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
|
#
1.29 |
|
16-Nov-2000 |
lukem |
* always run `status'; i.e, ignore the setting of $rcvar just like `rcvar' does. * 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.
|
#
1.28 |
|
05-Nov-2000 |
lukem |
when doing `status', return non-zero if the program isn't running. request by thorpej.
|
#
1.27 |
|
05-Nov-2000 |
lukem |
when running `forcerestart', call the underlying `stop' and `start' with the `force' prefix as well
|
#
1.26 |
|
07-Oct-2000 |
lukem |
use ${foo##*/} instead of `basename $foo`. as suggested (with minor variation) by Toru Nishimura <nisimura@itc.aist-nara.ac.jp>
|
#
1.25 |
|
01-Oct-2000 |
lukem |
remove unnecessary leading `$' on warnings printed for $required_dirs and $required_files.
|
#
1.24 |
|
19-Sep-2000 |
lukem |
- only perform the checkyesno on the variable named in $rcvar (rather than 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
|
#
1.23 |
|
19-Aug-2000 |
lukem |
support ${name}_nice even when using ${name}_chroot. per discussion with mrg...
|
#
1.22 |
|
17-Aug-2000 |
lukem |
add support for ${name}_chroot, which chroot(8)s before running the command. 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 :-]
|
#
1.21 |
|
20-Jul-2000 |
lukem |
in err() and warn() put a : between the ERROR/WARNING label and the message
|
Revision tags: netbsd-1-5-base
|
#
1.20 |
|
09-Jun-2000 |
fvdl |
branches: 1.20.2; Add and rc.conf.d directory. If a config file for command X exists (/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
|
Revision tags: minoura-xpg4dl-base
|
#
1.19 |
|
13-May-2000 |
lukem |
branches: 1.19.2; Implement load_rc_config(), which takes the config name as an argument. 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/*.
|
#
1.18 |
|
12-May-2000 |
lukem |
implement three new variables for run_rc_command: - ${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 :)
|
#
1.17 |
|
30-Apr-2000 |
lukem |
- prefix some more local variables with `_' (when you have a convention, stick to it :-) - simplify run_rc_script (no need to support fast* or force* here...) - clarify some comments
|
#
1.16 |
|
29-Apr-2000 |
lukem |
change run_rc_command() to take the list of extra commands supported 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.
|
#
1.15 |
|
27-Apr-2000 |
lukem |
in check_pidfile and check_process, also match "(" + `basename prog` + ")" . noted by veego@
|
#
1.14 |
|
26-Apr-2000 |
lukem |
don't bother checking rc_configured each time run_rc_command executes; once in /etc/rc is enough
|
#
1.13 |
|
21-Apr-2000 |
lukem |
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).
|
#
1.12 |
|
18-Apr-2000 |
simonb |
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.
|
#
1.11 |
|
10-Mar-2000 |
lukem |
* add: 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
|
Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
|
#
1.10 |
|
07-Jul-1999 |
drochner |
repair diskless startup: "netstart" needs "sysctl" and "awk" now, thus "/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...
|
#
1.9 |
|
28-Apr-1999 |
nathanw |
Move the knowledge that /usr and /var should be mounted early from 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.
|
#
1.8 |
|
12-Apr-1999 |
cjs |
When checking local status, jJust ignore not-found filesystems, rather than printing an error, just as we do when we try to mount it.
|
Revision tags: netbsd-1-4-base
|
#
1.7 |
|
31-Mar-1999 |
cjs |
branches: 1.7.2; 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.
|
#
1.6 |
|
24-Mar-1999 |
mellon |
- Move critical filesystem mounting code into a shell function and put that in rc.subr. - Support critfs_require_network rc.conf variable.
|
#
1.5 |
|
28-Feb-1998 |
lukem |
improve description comment
|
#
1.4 |
|
28-Feb-1998 |
lukem |
* add synonyms for "yes": "true", "on", and "1" * add synonyms for "no": "false", "off", and "0" * remove unnecessary trailing semicolons (this is sh, not C)
|
#
1.3 |
|
25-Jan-1998 |
lukem |
convert 'if .. else .. fi' into a 'case .. esac', and allow for any uppercase/lowercase variations of 'yes' and 'no'. fixes [misc/4887] sent in by "John F. Woods" <jfw@jfwhome.funhouse.com>
|
Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
|
#
1.2 |
|
29-Aug-1997 |
cjs |
Prune unused function.
|
#
1.1 |
|
28-Aug-1997 |
cjs |
Split rc.conf variables for starting programs into two: an on/off 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.
|
#
1.96 |
|
07-Oct-2014 |
roy |
sleep for 0.05 seconds instead of 2 seconds when checking if the pids are still alive for a much faster exit.
|
#
1.95 |
|
21-Sep-2014 |
roy |
Add checkyesnox function so we can test a configurable without being warned of its non-existance.
|
#
1.94 |
|
27-Jul-2014 |
apb |
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.
|
#
1.93 |
|
22-Jul-2014 |
wiz |
'file system' for consistency with documentation (instead of 'filesystem').
|
#
1.92 |
|
17-Dec-2012 |
apb |
branches: 1.92.8; Add shell implementations of basename and dirname to rc.subr. They are supposed to mimic basename(1) and dirname(1), except that they are usable before /usr/bin is mounted.
|
#
1.91 |
|
07-Apr-2012 |
christos |
branches: 1.91.2; back out change that makes onestart work, to be committed at some other time.
|
#
1.90 |
|
07-Apr-2012 |
christos |
give wedges to everyone
|
#
1.89 |
|
06-Apr-2012 |
apb |
The error message when /var is not a file system chhanged from mount: unknown special file or file system `/var' to mount: Unknown special file or file system `/var' so match them both.
|
#
1.88 |
|
11-Aug-2011 |
apb |
branches: 1.88.2; 1.88.4; 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.
|
#
1.87 |
|
09-Jun-2011 |
christos |
PR/42642: Ed Ravin: Handle daemons that start with #!/usr/bin/env interp
|
#
1.86 |
|
26-Sep-2010 |
apb |
branches: 1.86.4; Add a collapse_backslash_newline function to rc.subr.
|
#
1.85 |
|
08-Jun-2010 |
christos |
use modulo instead of logical and. from pooka
|
#
1.84 |
|
08-Jun-2010 |
christos |
explain why this code is there.
|
#
1.83 |
|
06-Jun-2010 |
christos |
fix conditional, from dholland.
|
#
1.82 |
|
04-Jun-2010 |
christos |
print human readable exit code.
|
#
1.81 |
|
15-Mar-2010 |
jmmv |
Allow the run_rc_command function in rc.subr to pass extra parameters to the command being executed. This is to allow rc.d scripts to do:
run_rc_command "${@}"
instead of:
run_rc_command "${1}"
and let the command handler (start, stop, etc.) receive the arguments after the command name.
None of the default commands allow extra arguments, and they will error out if any are given. This is mostly useful for script-specific commands that are only supposed to be used through the command line and, therefore, need to provide a friendly interface.
Proposed in tech-userlevel@. No major objections except for some minor concerns regarding whether this should be allowed or not at all. Note that I'm not touching any of the rc.d scripts in the base system, so this is effectively a no-op from the user point of view.
|
#
1.80 |
|
14-Sep-2009 |
apb |
Fix some errors in the way scripts with "KEYWORD: interactive" are handled. There was an inverted test, and "set $_args" had the wrong scope (in several nearly-identical blocks of code).
|
#
1.79 |
|
14-Sep-2009 |
apb |
Add the ability for file systems mounted via mount_critical_filesystems() in rc.subr to be marked as optional. This means that it's not an error if the file system is not mentioned in /etc/fstab. It is still an error if something else goes wrong.
Change the defaults for these two variables in /etc/defaults/rc.conf: critical_filesystems_local="OPTIONAL:/var" critical_filesystems_remote="OPTIONAL:/usr"
|
#
1.78 |
|
11-Sep-2009 |
apb |
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.
|
#
1.77 |
|
04-Sep-2009 |
apb |
Change multiple spaces to tabs on one line
|
#
1.76 |
|
10-Jul-2009 |
christos |
1. centralize the fsck error handling 2. don't check if root is on nfs 3. reboot -n if root was modified as the manual page suggests
|
#
1.75 |
|
27-Apr-2009 |
reed |
Get rid of extra space in Usage statement.
|
#
1.74 |
|
06-Dec-2008 |
salo |
branches: 1.74.2; A very old patch sitting in my tree..
When rc scripts are started from interactive shell, be nice and when user tries to start an unconfigured service, point him to rc.conf(5) and tell him about the one* keyword. Also be more user friendly when an unknown argument is entered.
Example:
# /etc/rc.d/cron start $cron is not enabled - see rc.conf(5). Use the following if you wish to perform the operation: /etc/rc.d/cron onestart
# /etc/rc.d/cron nonsense /etc/rc.d/cron: unknown directive 'nonsense'. Usage: /etc/rc.d/cron [fast|force|one](start stop restart rcvar status poll)
Inspired by discussion on tech-userlevel:
http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0010.html http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0011.html http://mail-index.netbsd.org/tech-userlevel/2007/02/13/0012.html
Reminded about it and reviewed by <lukem>
|
#
1.73 |
|
22-Jun-2008 |
dholland |
branches: 1.73.2; fix typo
|
#
1.72 |
|
22-May-2008 |
he |
Add support for optionally setting some environment variables before starting ${command}, via ${name}_env.
Discussed with lukem.
|
#
1.71 |
|
30-Apr-2008 |
martin |
branches: 1.71.2; Convert TNF licenses to new 2 clause variant
|
#
1.70 |
|
31-Dec-2007 |
ad |
branches: 1.70.2; 1.70.6; 1.70.8; Remove systrace. Ok core@.
|
#
1.69 |
|
06-Apr-2007 |
apb |
branches: 1.69.4; * Add a stop_boot() function in rc.subr, to terminate a multi-user boot by killing the parent process. The parent's PID is saved in $RC_PID. * In all rc.d/* scripts that previously tried to stop the boot, replace in-line code with "stop_boot". * Document this.
This should fix PR 29822.
|
#
1.68 |
|
27-Jan-2007 |
hubertf |
_find_processes(): in addition to the existing "interpreter: /path/to/daemon" also recognize "interpreter: daemon" in ps(1) output.
That case statement should be rewritten with expr(1) if more flexibility is needed.
Fixes PR 35366 by Dominik Joe Pantucek, debugged with much assistance by him on IRC.
|
#
1.67 |
|
07-Oct-2006 |
elad |
branches: 1.67.2; PR/32004: Ed Ravin: command interpreter test in rc.subr doesn't accomodate chroots
Patch applied, thanks!
okay apb@
|
#
1.66 |
|
01-Apr-2006 |
he |
In order to handle some perl scripts running as daemons, add a pattern which also matches "`basename $interpreter`: $command" in the ps listing. Should fix PR#31932.
|
#
1.65 |
|
12-Oct-2004 |
lukem |
branches: 1.65.2; * Implement load_rc_config_var cmd var to load the rc.conf(5) configuration for cmd and set var in the current shell, using 'load_rc_config var' in a sub-shell to avoid unwanted side-effects.
* Improve required_vars warning message.
|
#
1.64 |
|
13-Aug-2004 |
mycroft |
Add an _rc_subr_loaded variable, set to ":" by rc.subr. Scripts can use this for a speedup by doing: $_rc_subr_loaded . /etc/rc.subr
|
#
1.63 |
|
03-May-2004 |
lukem |
When performing "start", "stop" or "reload" in run_rc_command(), send any "<name> already running" or "<name> not running" messages to stderr instead of stdout before the (existing) non-zero exit.
|
#
1.62 |
|
02-Apr-2004 |
jmmv |
Introduce and use the rcvar_manpage variable, which contains the manual page name where the user should look at for documentation about rcvar. It defaults to 'rc.subr(5)', as rc.subr is mainly used by rc.d scripts.
This variable is useful to let the daily, weekly, monthly and security scripts tune the warning message shown when any of the variables they handle is not properly set.
Closes PR misc/23908.
|
#
1.61 |
|
05-Jan-2004 |
lukem |
branches: 1.61.4; Implement ``one'' prefix to allow a "one shot" operation as if ${rcvar}=yes yet all the other prerequisite tests are still performed. The existing ``force'' prefix is a sledgehammer that ignores all the prerequisite checks and always returns a zero exit status; this is a more gentle approach to the problem of "manipulate this disabled service without editing rc.conf(5)".
|
#
1.60 |
|
25-Jul-2003 |
lukem |
Add "*,v" to the list of scratch files to skip. Suggested by Johnny Lam / Alistair Crooks
|
#
1.59 |
|
04-Jul-2003 |
lukem |
Revert previous; the "return" if rc.subr had already loaded had issues in some circumstances where run_rc_script()'s sourcing of an rc.d file which then sourced rc.subr, the `optimisation' in rc.subr to "return as we're already loaded" would finish more than just the inner-most sourcing. I haven't tracked down the exact issue, but removing the `optimisation' fixes the problem I noticed in starting up certain rc.d scripts, and may fix [bin/22053] as well.
|
#
1.58 |
|
26-Jun-2003 |
lukem |
If _rc_subr_loaded=true, "return" immediately, otherwise set that var and continue as normal. Gains ~ 2 seconds on 110 runs of ". rc.subr" on a shark. Suggested by Andrew Cagney in [bin/18400]
|
#
1.57 |
|
26-Jun-2003 |
lukem |
run_rc_command(): when checking if ${command} exists before executing it, be sure to check under ${name_chroot} (if set). Fix from Ed Ravin in [bin/18523]
|
#
1.56 |
|
03-Jun-2003 |
christos |
Use more concise shell syntax: 1. for i in $* -> for i 2. foo=$* -> foo="$@"
|
#
1.55 |
|
05-Jan-2003 |
lukem |
Fix logic error I introduced recently into mount_critical_filesystems(). Noted by kilbi@rad.rwth-aachen.de in [bin/19703].
|
#
1.54 |
|
05-Jan-2003 |
lukem |
'if ! command;' is not POSIX sh, even though our /bin/sh supports it
|
#
1.53 |
|
04-Jan-2003 |
lukem |
Change how internal boolean variables are used to: if ! ${_somevar:-false}; then _somevar=true fi (Consisent, slightly quicker, and slightly cleaner)
|
#
1.52 |
|
26-Aug-2002 |
abs |
Append ' - see rc.conf(5)' to unset variable warning: /etc/rc.d/fu: WARNING: $fu is not set properly - see rc.conf(5). Add a note to rc.conf that third party packages may test for additional variables.
|
#
1.51 |
|
25-Jul-2002 |
grant |
add test for /usr/bin/logger in warn/err.
|
#
1.50 |
|
07-Jul-2002 |
atatat |
Add systrace(1) support to rc.subr. Most services (eg, ${name} is 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.
|
#
1.49 |
|
21-May-2002 |
lukem |
branches: 1.49.2; When using backup_uses_rcs=YES in backup_file(), after checking the file 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").
|
#
1.48 |
|
18-Apr-2002 |
lukem |
consistently set rc_(fast|force)=yes
|
#
1.47 |
|
27-Mar-2002 |
lukem |
Replace $critical_filesystems_beforenet with $critical_filesystems_local . 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!
|
#
1.46 |
|
21-Mar-2002 |
lukem |
- 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].
|
#
1.45 |
|
21-Mar-2002 |
lukem |
- Add run_rc_command() control variable $command_interpreter 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.
|
#
1.44 |
|
12-Mar-2002 |
lukem |
Use ${_arg}_postcmd even if we're not using the default ${_arg}_cmd method.
|
#
1.43 |
|
12-Mar-2002 |
lukem |
Implement ${_arg}_postcmd support, which is run if a default start/stop/reload/restart operation succeeds (i.e, zero exit code). Code from Lubomir Sedlacik <salo@Xtrmntr.org>.
|
#
1.42 |
|
25-Feb-2002 |
lukem |
Fixes derived from [bin/15563] submitted by Ron Roskens: - 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.
|
#
1.41 |
|
25-Feb-2002 |
lukem |
fix spelo. crank copyright year
|
#
1.40 |
|
25-Feb-2002 |
lukem |
Don't run "status" as if "force" is set, thus reverting part of rev 1.29. 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.
|
#
1.39 |
|
24-Feb-2002 |
lukem |
run_rc_script() improvements: - 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
|
#
1.38 |
|
18-Nov-2001 |
lukem |
Add reverse_list(), which prints the reverse of the list of words. Doesn't attempt to handle words with whitespace, etc.
|
#
1.37 |
|
18-Jun-2001 |
lukem |
Improve run_rc_script(): - 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].
|
#
1.36 |
|
10-May-2001 |
atatat |
When using rcs to track backups, force the rcs archive to be unlocked, use only non-strict locking, and leave the archives unlocked after checking in changes.
|
#
1.35 |
|
08-May-2001 |
lukem |
* change wait_for_pids() to spin forever (rather than just ~ 65 seconds). * 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 ?)
|
#
1.34 |
|
07-May-2001 |
lukem |
Don't try and use single quotes in the RHS of a ${ :+ } expansion 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.
|
#
1.33 |
|
17-Apr-2001 |
lukem |
* provide wait_for_pids(), which spins until all the given pids don't exist * 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.
|
#
1.32 |
|
06-Apr-2001 |
lukem |
clarify that ${name}_groups is comma separated
|
#
1.31 |
|
03-Apr-2001 |
atatat |
Provide the capability of storing backups via RCS instead of just a "current" and a "last" (which is useless if you wanna know what you changed last week). Set the default to on.
|
#
1.30 |
|
28-Feb-2001 |
lukem |
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
|
#
1.29 |
|
16-Nov-2000 |
lukem |
* always run `status'; i.e, ignore the setting of $rcvar just like `rcvar' does. * 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.
|
#
1.28 |
|
05-Nov-2000 |
lukem |
when doing `status', return non-zero if the program isn't running. request by thorpej.
|
#
1.27 |
|
05-Nov-2000 |
lukem |
when running `forcerestart', call the underlying `stop' and `start' with the `force' prefix as well
|
#
1.26 |
|
07-Oct-2000 |
lukem |
use ${foo##*/} instead of `basename $foo`. as suggested (with minor variation) by Toru Nishimura <nisimura@itc.aist-nara.ac.jp>
|
#
1.25 |
|
01-Oct-2000 |
lukem |
remove unnecessary leading `$' on warnings printed for $required_dirs and $required_files.
|
#
1.24 |
|
19-Sep-2000 |
lukem |
- only perform the checkyesno on the variable named in $rcvar (rather than 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
|
#
1.23 |
|
19-Aug-2000 |
lukem |
support ${name}_nice even when using ${name}_chroot. per discussion with mrg...
|
#
1.22 |
|
17-Aug-2000 |
lukem |
add support for ${name}_chroot, which chroot(8)s before running the command. 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 :-]
|
#
1.21 |
|
20-Jul-2000 |
lukem |
in err() and warn() put a : between the ERROR/WARNING label and the message
|
#
1.20 |
|
09-Jun-2000 |
fvdl |
branches: 1.20.2; Add and rc.conf.d directory. If a config file for command X exists (/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
|
#
1.19 |
|
13-May-2000 |
lukem |
branches: 1.19.2; Implement load_rc_config(), which takes the config name as an argument. 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/*.
|
#
1.18 |
|
12-May-2000 |
lukem |
implement three new variables for run_rc_command: - ${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 :)
|
#
1.17 |
|
30-Apr-2000 |
lukem |
- prefix some more local variables with `_' (when you have a convention, stick to it :-) - simplify run_rc_script (no need to support fast* or force* here...) - clarify some comments
|
#
1.16 |
|
30-Apr-2000 |
lukem |
change run_rc_command() to take the list of extra commands supported 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.
|
#
1.15 |
|
27-Apr-2000 |
lukem |
in check_pidfile and check_process, also match "(" + `basename prog` + ")" . noted by veego@
|
#
1.14 |
|
26-Apr-2000 |
lukem |
don't bother checking rc_configured each time run_rc_command executes; once in /etc/rc is enough
|
#
1.13 |
|
21-Apr-2000 |
lukem |
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).
|
#
1.12 |
|
18-Apr-2000 |
simonb |
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.
|
#
1.11 |
|
10-Mar-2000 |
lukem |
* add: 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
|
#
1.10 |
|
07-Jul-1999 |
drochner |
repair diskless startup: "netstart" needs "sysctl" and "awk" now, thus "/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...
|
#
1.9 |
|
28-Apr-1999 |
nathanw |
Move the knowledge that /usr and /var should be mounted early from 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.
|
#
1.8 |
|
12-Apr-1999 |
cjs |
When checking local status, jJust ignore not-found filesystems, rather than printing an error, just as we do when we try to mount it.
|
#
1.7 |
|
31-Mar-1999 |
cjs |
branches: 1.7.2; 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.
|
#
1.6 |
|
24-Mar-1999 |
mellon |
- Move critical filesystem mounting code into a shell function and put that in rc.subr. - Support critfs_require_network rc.conf variable.
|
#
1.5 |
|
28-Feb-1998 |
lukem |
improve description comment
|
#
1.4 |
|
28-Feb-1998 |
lukem |
* add synonyms for "yes": "true", "on", and "1" * add synonyms for "no": "false", "off", and "0" * remove unnecessary trailing semicolons (this is sh, not C)
|
#
1.3 |
|
25-Jan-1998 |
lukem |
convert 'if .. else .. fi' into a 'case .. esac', and allow for any uppercase/lowercase variations of 'yes' and 'no'. fixes [misc/4887] sent in by "John F. Woods" <jfw@jfwhome.funhouse.com>
|
#
1.2 |
|
29-Aug-1997 |
cjs |
Prune unused function.
|
#
1.1 |
|
28-Aug-1997 |
cjs |
Split rc.conf variables for starting programs into two: an on/off 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.
|
#
1.7.2.1 |
|
15-Apr-1999 |
cjs |
Bring branch up to head revision 1.8.
|
#
1.19.2.1 |
|
23-Jun-2000 |
minoura |
Sync w/ netbsd-1-5-base.
|
#
1.20.2.4 |
|
01-Oct-2000 |
lukem |
pull up rev 1.25 (approved by thorpej): remove unnecessary leading `$' on warnings printed for $required_dirs and $required_files.
|
#
1.20.2.3 |
|
01-Oct-2000 |
lukem |
pull up rev 1.24 (approved by thorpej): large changes. summary: - always use $rcvar to determine the name of the var to checkyesno - fix force*
|
#
1.20.2.2 |
|
23-Aug-2000 |
lukem |
pull up revs 1.22-1.23: add ${name}_chroot support
approved: thorpej
|
#
1.20.2.1 |
|
09-Aug-2000 |
lukem |
pull up rev 1.21 approved by: thorpej
1.21: in err() and warn() put a : between the ERROR/WARNING label and the message
|
#
1.49.2.3 |
|
28-Jun-2003 |
grant |
Pull up revision 1.57 (requested by lukem in ticket #1346):
run_rc_command(): when checking if ${command} exists before executing it, be sure to check under ${name_chroot} (if set). Fix from Ed Ravin in [bin/18523]
|
#
1.49.2.2 |
|
24-Nov-2002 |
tron |
Pull up revision 1.52 (requested by abs in ticket #732): Append ' - see rc.conf(5)' to unset variable warning: /etc/rc.d/fu: WARNING: $fu is not set properly - see rc.conf(5). Add a note to rc.conf that third party packages may test for additional variables.
|
#
1.49.2.1 |
|
29-Jul-2002 |
lukem |
Pull up revision 1.51 (requested by grant in ticket #551): add test for /usr/bin/logger in warn/err.
|
#
1.61.4.2 |
|
21-Apr-2006 |
tron |
Pull up following revision(s) (requested by he in ticket #10413): etc/rc.subr: revision 1.66 In order to handle some perl scripts running as daemons, add a pattern which also matches "`basename $interpreter`: $command" in the ps listing. Should fix PR#31932.
|
#
1.61.4.1 |
|
08-May-2005 |
riz |
Pull up revision 1.65 (requested by lukem in ticket #1268): * Implement load_rc_config_var cmd var to load the rc.conf(5) configuration for cmd and set var in the current shell, using 'load_rc_config var' in a sub-shell to avoid unwanted side-effects. * Improve required_vars warning message.
|
#
1.65.2.1 |
|
04-Apr-2006 |
tron |
Pull up following revision(s) (requested by he in ticket #1238): etc/rc.subr: revision 1.66 In order to handle some perl scripts running as daemons, add a pattern which also matches "`basename $interpreter`: $command" in the ps listing. Should fix PR#31932.
|
#
1.67.2.1 |
|
10-Feb-2007 |
tron |
Pull up following revision(s) (requested by hubertf in ticket #433): etc/rc.subr: revision 1.68 _find_processes(): in addition to the existing "interpreter: /path/to/daemon" also recognize "interpreter: daemon" in ps(1) output. That case statement should be rewritten with expr(1) if more flexibility is needed. Fixes PR 35366 by Dominik Joe Pantucek, debugged with much assistance by him on IRC.
|
#
1.69.4.1 |
|
08-Jan-2008 |
matt |
sync with HEAD
|
#
1.70.8.2 |
|
03-Jun-2008 |
yamt |
sync with head
|
#
1.70.8.1 |
|
18-May-2008 |
yamt |
sync with head.
|
#
1.70.6.3 |
|
17-Jan-2009 |
mjf |
Sync with HEAD.
|
#
1.70.6.2 |
|
29-Jun-2008 |
mjf |
Sync with HEAD.
|
#
1.70.6.1 |
|
02-Jun-2008 |
mjf |
Sync with HEAD.
|
#
1.70.2.2 |
|
31-Dec-2007 |
ad |
Remove systrace. Ok core@.
|
#
1.70.2.1 |
|
31-Dec-2007 |
ad |
file rc.subr was added on branch mjf-devfs on 2007-12-31 15:31:41 +0000
|
#
1.71.2.2 |
|
17-Sep-2008 |
wrstuden |
Sync with wrstuden-revivesa-base-2.
|
#
1.71.2.1 |
|
22-Jun-2008 |
wrstuden |
Sync w/ -current. 34 merge conflicts to follow.
|
#
1.73.2.1 |
|
06-Jan-2011 |
riz |
Pull up following revision(s) (requested by enami in ticket #1504): share/man/man8/rc.subr.8: revision 1.27 etc/rc.subr: revision 1.86 share/man/man5/ifconfig.if.5: revision 1.14 etc/rc.d/network: revision 1.61 Add a collapse_backslash_newline function to rc.subr. Collapse <abckslash><newline> sequences in /etc/ifconfig.xxx files read by /etc/rc.d/network. Fixes PR 41662 by Christoph Badura, which was also reported independently by Jeremy C. Reed.
|
#
1.74.2.1 |
|
13-May-2009 |
jym |
Sync with HEAD.
Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
|
#
1.86.4.1 |
|
23-Jun-2011 |
cherry |
Catchup with rmind-uvmplock merge.
|
#
1.88.4.1 |
|
09-Apr-2012 |
riz |
Pull up following revision(s) (requested by apb in ticket #170): etc/rc.subr: revision 1.89 The error message when /var is not a file system chhanged from mount: unknown special file or file system `/var' to mount: Unknown special file or file system `/var' so match them both.
|
#
1.88.2.2 |
|
22-Jan-2013 |
yamt |
sync with head
|
#
1.88.2.1 |
|
16-Apr-2012 |
yamt |
sync with head
|
#
1.91.2.2 |
|
19-Aug-2014 |
tls |
Rebase to HEAD as of a few days ago.
|
#
1.91.2.1 |
|
24-Feb-2013 |
tls |
resync with head
|
#
1.92.8.1 |
|
10-Aug-2014 |
tls |
Rebase.
|