summaryrefslogtreecommitdiffstats
path: root/etc/rc.subr
Commit message (Collapse)AuthorAgeFilesLines
* rc.subr: disabling globbing while processing devfs rulesavg2013-03-281-1/+7
| | | | | | | | The rules themselves typically have shell-like patterns and it is incorrect when they get replaced with matching filesystem entries. Shell magic by: jilles MFC after: 2 weeks
* Allow perl scripts to be used in rc.d scriptssmh2013-01-101-1/+1
| | | | | | | PR: conf/117027 Reviewed by: pjd (mentor) Approved by: hrs MFC after: 2 weeks
* Do not put "already running" message when rc_quiet=yes.hrs2012-11-201-1/+4
| | | | PR: bin/165477
* Add check_namevarlist() to check if ${name}_var is reserved in rc.subr or not.hrs2012-11-171-0/+17
|
* Add setfib(1) support for services as <name>_fib in rc.conf.hrs2012-10-271-1/+6
|
* Allow spaces in _chrootcrees2012-10-271-3/+3
| | | | | | Noticed by: adj (IRC/#bsdports) Approved by: hrs MFC after: 1 month
* Whitespace nitkevlo2012-07-131-2/+2
|
* Put the signal trap output to standard error instead of standard output.delphij2012-02-181-3/+3
| | | | | | | | | | | Without this change, pressing ^T could result in rc.d script putting junk strings like: Script <filename> running in configuration files when redirecting standard output to these files. MFC after: 2 weeks
* Fix various issues with the NFS and RPC related scripts:dougb2012-02-141-4/+11
| | | | | | | | | | | | | | | | | | | 1. Add new functionality to the force_depend method to incorporate the tests for whether the service is enabled and/or already running. 2. Add a new option to bypass checking only that the service is enabled at boot time, and always check if it is running. 3. Use this new functionality to greatly simplify the rc.d scripts that use force_depend. 4. Add a force_depend for statd in lockd 5. Remove the check that either nfs_server or nfs_client is _enable'd from statd and lockd. This was always overkill, and prevented using the {one|force}start options, as well as stop'ing on the command line. 6. The yp* scripts had some of their arguments in various weird orders. Bring them into line with the model. 7. If mountd fails to create /var/db/mountdtab, err out. Ideas, suggestions, and/or review from delphij and jilles. Pointy hats are completely my responsibility however.
* If we're booting there is no need to waste time determining if the servicedougb2012-01-201-1/+1
| | | | | | | is running or not. PR: conf/150752 Submitted by: YIN Xiaofeng <75394094@qq.com>
* Now that its callers have been udpated, remove set_rcvar().dougb2012-01-141-46/+5
| | | | | | The concept of set_rcvar() was nice in theory, but the forks it creates are a drag on the startup process, which is especially noticeable on slower systems, such as embedded ones.
* rc.d: document 'quiet' prefix and fix dhclient/devd interactionrea2012-01-121-1/+1
| | | | | | | | | | | | | | | | | | | | | Document the current semantics of the 'quiet' command prefix in the rc.subr(8). Fix dhclient rc.d script: it should not call err() for non-DHCP-enabled interface when it is called from devd, because the latter just blindly calls 'service dhclient quietstart' on each "link up" event. Since the 'quietstart' will silence the message "Cannot 'start' <foo>. Set <foo>_enable to YES in /etc/rc.conf or use 'onestart' instead of 'start'." and running dhclient on the non-DHCP-enabled interface is the same thing as running the service <foo> without <foo>_enable set, such modification is in sync with the current semantics of the 'quiet' prefix. Approved by: glebius Reviewed by: freebsd-rc list MFC after: 2 weeks
* There is no longer a need to abstract ${rcvar_manpage} as we are notdougb2012-01-081-2/+1
| | | | attempting to maintain compatibility with NetBSD for some years now.
* Spelling fixes for etc/uqs2012-01-071-1/+1
|
* rc.d: Eliminate some unnecessary non-POSIX constructs:jilles2011-11-081-1/+1
| | | | | | * set - ... * empty braces * ^ in character class
* rc.subr: Make sure all functions are under if [ -z "${_rc_subr_loaded}" ].jilles2011-06-191-2/+2
|
* rc.subr: Eliminate a fork from check_kern_features, like r223227.jilles2011-06-191-1/+1
| | | | MFC after: 2 weeks
* rc.subr: Eliminate about 100 forks from the boot sequence.jilles2011-06-181-5/+5
| | | | | | | | | | | | With the current sh, placing eval in a command substitution always results in a fork(), even if it is the only command and only executes a single simple command. Therefore, avoid it where it can be avoided easily. Side effect: values starting with a hyphen and all whitespace are preserved. The values are defaults and names for rc.conf variables and messages to be given about obsolete ones. MFC after: 2 weeks
* Add a helper function to check kern.features.* sysctls.hrs2011-06-111-0/+22
| | | | Discussed with: dougb
* As previously advertised, remove the error message for enable_quotasdougb2011-04-231-4/+0
| | | | | | prior to 9.0-RELEASE. This change should not be MFC'ed.
* Improve the error handling for the new get_pidfile_from_conf()dougb2011-04-231-2/+6
|
* Introduce to rc.subr get_pidfile_from_conf(). It does just what it soundsdougb2011-04-231-0/+39
| | | | | | | | | like, determines the path to a pid file as it is specified in a conf file. Use the new feature for rc.d/named and rc.d/devd, the 2 services in the base that list their pid files in their conf files. Remove the now-obsolete named_pidfile, and warn users if they have it set.
* The change in r206686 to allow the stop argument to work for a servicedougb2011-04-171-1/+2
| | | | | | | | | | | | | | that is running even though not _enable'd had an annoying side effect. If the service was already started at boot time by another means when the related script came around again in rcorder it would start again, regardless of _enable, because there was a valid pid. [1] So, split the test into 2 parts, one for (!rcvar && !stop), and one for (stop && !valid_pid). This preserves the behavior from r206686 while preventing the undesired side effect. PR: conf/156427 [1] Submitted by: Eugene Grosbein <eugen@grosbein.pp.ru> [1]
* Revert r219578dougb2011-03-131-3/+3
|
* Use the allexport option in load_rc_config() in order to avoid havingdougb2011-03-121-3/+3
| | | | | | | | | | | | | | to repeatedly read the conf files. Depending on what is enabled the files are being read anywhere from 15, 30, or more times currently. By loading the values in the environment this is reduced to 1, with perhaps a couple more, again depending on what is enabled. The speed-up for boot and shutdown is negligible when rc.conf is on local disk, noticable when accessing files over NFS, and dramatic when pulling rc.conf values from a database. This change also includes a minor optimization to the conditional for $_rc_conf_loaded.
* Warn if rules could not be read from a ruleset file. Now at leastjh2011-01-071-1/+4
| | | | | | | something gets logged if the file has syntax errors. PR: conf/91342 Silence on: freebsd-rc
* Fix silly typo on my part (s/quotas_enable/quota_enable/)dougb2010-08-141-1/+1
| | | | Submitted by: ed
* Give people some warning before removing enable_quotasdougb2010-08-141-2/+2
|
* If a service is running, make 'stop' work even if ${name}_enabledougb2010-04-151-3/+3
| | | | | | | | is not set. PR: conf/130414 Submitted by: Dominic Fandrey <kamikaze@bsdforen.de> Reviewed by: freebsd-rc@
* In wait_for_pids(), pwait(1) can return when the process exits, butdougb2010-04-061-1/+4
| | | | | | | | | | | | | | | | still exists as a zombie. The 'kill -0' test in this function can therefore return true even if the process isn't actually running. This could lead to wait_for_pids() printing an endless string of the pid number until the zombie finally exits. Solve this problem by moving the sleep up to after the 'kill -0' test, but only after we've run through the function once already. In the common case (only one pid in the list) this will always do the right thing. On the rare occasion that there is more than one pid in the list this will sleep 1 second per zombie process which will allow that process, and any other in the list a chance to exit. While I'm here, local'ize the variables that this function uses.
* Convert to 2-clause license, from NetBSD rc.subr r1.70.emaste2010-01-261-7/+0
| | | | | Submitted by: Alex Kozlov Obtained from: NetBSD
* Remove vestigial NetBSD compatibility shim.emaste2010-01-251-11/+1
|
* Update the comments about files ending in .shdougb2009-12-271-4/+5
| | | | Prompted by: Alex Kozlov <spam@rm-rf.kiev.ua>
* Delete some trailing whitespacedougb2009-12-271-2/+2
|
* rc.subr: Use pwait in wait_for_pids.jilles2009-12-211-1/+1
| | | | | | | | | | This waits for the requested process(es) to terminate, rather than polling with an interval of 2 seconds. If pwait is not available, the old method is used. PR: conf/132766 Reviewed by: dougb
* Fix qouting in a comment, to make it look more consistented2009-10-181-1/+1
| | | | | Submitted by: Jille Timmermans <jille quis cx> MFC after: 1 week
* Allow $name_program to override $command in a more robust way thatdougb2009-10-151-1/+1
| | | | will not cause the value to be null if $command is not set.
* In regards to the "Starting foo:" type messages at boot time, create anddougb2009-10-101-7/+15
| | | | | | | | | | | | | | | | | | | | | | | employ a more generic solution, and use it in the individual rc.d scripts that also have an $rc_quiet test: 1. Add check_startmsgs() to rc.subr. 2. In the rc.d scripts that use rc_quiet (and rc.subr) substitute variations of [ -z "$rc_quiet" ] with check_startmsgs 3. In savecore add a trailing '.' to the end of the message to make it more consistent with other scripts. 4. In newsyslog remove a : before the terminal '.' since we do not expect there to be anything printed out in between to make it more consistent. 5. In the following scripts change "quotes" to 'quotes' where no variables exist in the message: savecore pf newsyslog 6. In the following scripts substitute if/then/fi for the simpler (and more consistent) check_startmsgs &&: faith stf 7. In the following scripts separate the "Starting foo:" from the terminal '.' to make them more consistent: moused hostname pf 8. In nfsclient move the message to its own line to avoid a style bug 9. In pf rc_quiet does not apply to the _stop method, so remove the test there. 10. In motd add 'quotes' around the terminal '.' for consistency
* Fix a case when both ${name}_program and ${command} are defined.hrs2009-10-051-1/+1
| | | | Spotted by: Michio "Karl" Jinbo
* Add a knob to show 'Starting foo:' messages when faststart is used,dougb2009-09-171-1/+7
| | | | such as at boot time.
* Add an extension of set_rcvar(), a new function set_rcvar_obsolete(),hrs2009-09-121-29/+143
| | | | | | | | | | | | | | | and $desc. The set_rcvar_obsolete() is for displaying an obsolete variable and the new one. More specifically, a warning is displayed when a variable is removed or changed in the source tree and the user still defines the old one. $router* and $ipv6_router* are replaced with $routed_* and $route6d_* for consistency. The old variables still work but can be removed in the future. MFC after: 3 days
* Now that the last of the *.sh scripts are gone from the base,dougb2009-05-301-2/+2
| | | | emit a warning if come across one.
* Show which rc script is running since the default ^T just shows 'sh' as thethompsa2008-10-271-0/+1
| | | | process.
* Move the diagnostic output when the rc.subr(8) glue automatically starts amtm2008-06-231-3/+9
| | | | | | | | | | service behind $rc_quiet. Instead, output a warning if the pre-command routine or the command itself failed. Arguably, it's more useful to know when a command failed to start than it is to have an endless list of "Starting ...." lines[1]. [1] - This change actually helped me to discover a bug in rc.d/{lockd,statd} (fixed in r179941) that used to fail silently before.
* Make quota knob conform to other rc(8) knobs. Keep older knob formtm2008-06-191-0/+4
| | | | | | compatibility. Requested by: Volker <volker@vwsoft.com>
* Move the check for enabled knobs further down in run_rc_command() somtm2008-06-191-14/+14
| | | | | that bogus commands cause usage information to be printed instead of diagnostics about enabling the knob.
* o Convert whitespaces to tabs.maxim2008-05-051-2/+2
|
* o Terminate "case" with "esac" not "fi".maxim2008-05-051-1/+1
| | | | Reported by: Randy Bush
* Fix improper use of checkyesno routine.mtm2008-05-051-2/+6
| | | | | Noticed by: oliver MFC after: 1 week
* Re-implement: do not silently fail when a command is not carriedmtm2008-01-261-1/+16
| | | | | | | | | | | | | | | out because the rc.conf(5) variable was not enabled. Display a message that the command wasn't run and offer suggestions on what the user can do. Implement a quiet prefix, which will disable some diagnostics. The fast prefix also implies quiet. During boot we use either fast or quiet. For shutdown we already use 'faststop'. So, this informational message should only appear during interactive use. An additional benefit of having a quiet prefix is that we can start putting some of our diagnostic messages behind this knob and start "de-cluttering" the console during boot and shutdown.
OpenPOWER on IntegriCloud