The NetBSD Project

CVS log for src/etc/rc.subr

[BACK] Up to [cvs.NetBSD.org] / src / etc

Request diff between arbitrary revisions


Default branch: MAIN
Current tag: MAIN


Revision 1.111 / (download) - annotate - [select for diffs], Sun May 22 11:27:33 2022 UTC (22 months, 3 weeks ago) by andvar
Branch: MAIN
CVS Tags: netbsd-10-base, netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10, HEAD
Changes since 1.110: +2 -2 lines
Diff to previous 1.110 (colored)

fix various small typos, mainly in comments.

Revision 1.110 / (download) - annotate - [select for diffs], Sun Feb 6 16:23:12 2022 UTC (2 years, 2 months ago) by alnsn
Branch: MAIN
Changes since 1.109: +9 -10 lines
Diff to previous 1.109 (colored)

Small changes in mount_critical_filesystems_zfs

avoid unnecessary eval, switch to $() and -ne.

from kre@, thanks!

Revision 1.109 / (download) - annotate - [select for diffs], Thu Feb 3 21:02:47 2022 UTC (2 years, 2 months ago) by alnsn
Branch: MAIN
Changes since 1.108: +2 -2 lines
Diff to previous 1.108 (colored)

Compare $_mount_es with 0

Revision 1.108 / (download) - annotate - [select for diffs], Thu Feb 3 20:52:44 2022 UTC (2 years, 2 months ago) by alnsn
Branch: MAIN
Changes since 1.107: +74 -1 lines
Diff to previous 1.107 (colored)

Add mount_critical_filesystems_zfs

The new function is similar to mount_critical_filesystems
but it walks through ZFS datasets and mounts matching entries.

Revision 1.107 / (download) - annotate - [select for diffs], Sat Nov 6 23:11:43 2021 UTC (2 years, 5 months ago) by christos
Branch: MAIN
Changes since 1.106: +2 -1 lines
Diff to previous 1.106 (colored)

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 1.106 / (download) - annotate - [select for diffs], Sun Dec 20 21:30:28 2020 UTC (3 years, 3 months ago) by uwe
Branch: MAIN
CVS Tags: cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Changes since 1.105: +3 -3 lines
Diff to previous 1.105 (colored)

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.

Revision 1.105 / (download) - annotate - [select for diffs], Thu Sep 17 20:29:03 2020 UTC (3 years, 6 months ago) by otis
Branch: MAIN
Changes since 1.104: +5 -4 lines
Diff to previous 1.104 (colored)

Fix waiting for PIDs on stop.

Fix expansion of positional parameters. Also move the local
variable declaration to more apropriate place.

Revision 1.104 / (download) - annotate - [select for diffs], Sun Apr 5 21:03:08 2020 UTC (4 years ago) by christos
Branch: MAIN
CVS Tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406
Changes since 1.103: +43 -16 lines
Diff to previous 1.103 (colored)

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 1.103 / (download) - annotate - [select for diffs], Sun Sep 23 23:02:39 2018 UTC (5 years, 6 months ago) by kre
Branch: MAIN
CVS Tags: phil-wifi-20191119, phil-wifi-20190609, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, netbsd-9-base, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9, is-mlppp-base, is-mlppp
Changes since 1.102: +25 -10 lines
Diff to previous 1.102 (colored)


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 1.102 / (download) - annotate - [select for diffs], Wed Apr 11 18:51:22 2018 UTC (6 years ago) by christos
Branch: MAIN
CVS Tags: phil-wifi-base, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415
Branch point for: phil-wifi
Changes since 1.101: +3 -3 lines
Diff to previous 1.101 (colored)

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 1.101 / (download) - annotate - [select for diffs], Sun Apr 1 18:26:51 2018 UTC (6 years ago) by kre
Branch: MAIN
CVS Tags: pgoyette-compat-0407
Changes since 1.100: +3 -3 lines
Diff to previous 1.100 (colored)


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 1.100 / (download) - annotate - [select for diffs], Thu Apr 13 02:15:36 2017 UTC (7 years ago) by christos
Branch: MAIN
CVS Tags: prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, pgoyette-localcount-20170426, pgoyette-compat-base, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, perseant-stdc-iso10646-base, perseant-stdc-iso10646, netbsd-8-base, matt-nb8-mediatek-base, matt-nb8-mediatek, bouyer-socketcan-base1
Branch point for: pgoyette-compat, netbsd-8
Changes since 1.99: +3 -3 lines
Diff to previous 1.99 (colored)

remove env.

Revision 1.99 / (download) - annotate - [select for diffs], Tue Mar 21 22:52:10 2017 UTC (7 years ago) by christos
Branch: MAIN
Changes since 1.98: +12 -3 lines
Diff to previous 1.98 (colored)

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 1.98 / (download) - annotate - [select for diffs], Sun Mar 6 18:49:42 2016 UTC (8 years, 1 month ago) by christos
Branch: MAIN
CVS Tags: pgoyette-localcount-base, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, localcount-20160914, bouyer-socketcan-base
Branch point for: pgoyette-localcount, bouyer-socketcan
Changes since 1.97: +15 -1 lines
Diff to previous 1.97 (colored)

Introduce kat() a built-in version of cat(1) that strips shell-like comments.

Revision 1.97 / (download) - annotate - [select for diffs], Sat Oct 31 12:31:37 2015 UTC (8 years, 5 months ago) by phx
Branch: MAIN
Changes since 1.96: +4 -14 lines
Diff to previous 1.96 (colored)

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.

Revision 1.96 / (download) - annotate - [select for diffs], Tue Oct 7 19:09:45 2014 UTC (9 years, 6 months ago) by roy
Branch: MAIN
Changes since 1.95: +8 -5 lines
Diff to previous 1.95 (colored)

sleep for 0.05 seconds instead of 2 seconds when checking if the pids
are still alive for a much faster exit.

Revision 1.95 / (download) - annotate - [select for diffs], Sun Sep 21 09:47:24 2014 UTC (9 years, 6 months ago) by roy
Branch: MAIN
Changes since 1.94: +21 -6 lines
Diff to previous 1.94 (colored)

Add checkyesnox function so we can test a configurable without
being warned of its non-existance.

Revision 1.94 / (download) - annotate - [select for diffs], Sun Jul 27 07:46:46 2014 UTC (9 years, 8 months ago) by apb
Branch: MAIN
CVS Tags: tls-maxphys-base, tls-earlyentropy-base, netbsd-7-base, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0
Branch point for: netbsd-7
Changes since 1.93: +39 -10 lines
Diff to previous 1.93 (colored)

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.

Revision 1.93 / (download) - annotate - [select for diffs], Tue Jul 22 17:11:09 2014 UTC (9 years, 8 months ago) by wiz
Branch: MAIN
Changes since 1.92: +3 -3 lines
Diff to previous 1.92 (colored)

'file system' for consistency with documentation (instead of 'filesystem').

Revision 1.92 / (download) - annotate - [select for diffs], Mon Dec 17 18:17:27 2012 UTC (11 years, 4 months ago) by apb
Branch: MAIN
CVS Tags: yamt-pagecache-base9, yamt-pagecache-base8, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, khorben-n900, agc-symver-base, agc-symver
Branch point for: tls-earlyentropy
Changes since 1.91: +29 -1 lines
Diff to previous 1.91 (colored)

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 1.91 / (download) - annotate - [select for diffs], Sat Apr 7 17:28:44 2012 UTC (12 years ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4
Branch point for: tls-maxphys
Changes since 1.90: +0 -3 lines
Diff to previous 1.90 (colored)

back out change that makes onestart work, to be committed at some other time.

Revision 1.90 / (download) - annotate - [select for diffs], Sat Apr 7 17:22:10 2012 UTC (12 years ago) by christos
Branch: MAIN
Changes since 1.89: +4 -1 lines
Diff to previous 1.89 (colored)

give wedges to everyone

Revision 1.89 / (download) - annotate - [select for diffs], Sat Apr 7 16:39:32 2012 UTC (12 years ago) by apb
Branch: MAIN
Changes since 1.88: +2 -2 lines
Diff to previous 1.88 (colored)

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 1.88 / (download) - annotate - [select for diffs], Thu Aug 11 22:52:47 2011 UTC (12 years, 8 months ago) by apb
Branch: MAIN
CVS Tags: yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, netbsd-6-base
Branch point for: yamt-pagecache, netbsd-6
Changes since 1.87: +73 -16 lines
Diff to previous 1.87 (colored)

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.

Revision 1.87 / (download) - annotate - [select for diffs], Thu Jun 9 14:52:01 2011 UTC (12 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.86: +9 -2 lines
Diff to previous 1.86 (colored)

PR/42642: Ed Ravin: Handle daemons that start with #!/usr/bin/env interp

Revision 1.86 / (download) - annotate - [select for diffs], Sun Sep 26 18:37:14 2010 UTC (13 years, 6 months ago) by apb
Branch: MAIN
CVS Tags: matt-mips64-premerge-20101231, cherry-xenmp-base, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2
Branch point for: cherry-xenmp
Changes since 1.85: +23 -2 lines
Diff to previous 1.85 (colored)

Add a collapse_backslash_newline function to rc.subr.

Revision 1.85 / (download) - annotate - [select for diffs], Tue Jun 8 18:04:17 2010 UTC (13 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.84: +2 -2 lines
Diff to previous 1.84 (colored)

use modulo instead of logical and. from pooka

Revision 1.84 / (download) - annotate - [select for diffs], Tue Jun 8 13:48:58 2010 UTC (13 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.83: +4 -1 lines
Diff to previous 1.83 (colored)

explain why this code is there.

Revision 1.83 / (download) - annotate - [select for diffs], Sun Jun 6 12:37:57 2010 UTC (13 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.82: +3 -3 lines
Diff to previous 1.82 (colored)

fix conditional, from dholland.

Revision 1.82 / (download) - annotate - [select for diffs], Fri Jun 4 18:42:54 2010 UTC (13 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.81: +19 -1 lines
Diff to previous 1.81 (colored)

print human readable exit code.

Revision 1.81 / (download) - annotate - [select for diffs], Mon Mar 15 18:59:47 2010 UTC (14 years, 1 month ago) by jmmv
Branch: MAIN
Changes since 1.80: +9 -4 lines
Diff to previous 1.80 (colored)

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 1.80 / (download) - annotate - [select for diffs], Mon Sep 14 22:30:30 2009 UTC (14 years, 7 months ago) by apb
Branch: MAIN
CVS Tags: matt-premerge-20091211
Changes since 1.79: +8 -5 lines
Diff to previous 1.79 (colored)

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).

Revision 1.79 / (download) - annotate - [select for diffs], Mon Sep 14 12:05:12 2009 UTC (14 years, 7 months ago) by apb
Branch: MAIN
Changes since 1.78: +49 -12 lines
Diff to previous 1.78 (colored)

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"

Revision 1.78 / (download) - annotate - [select for diffs], Fri Sep 11 18:17:04 2009 UTC (14 years, 7 months ago) by apb
Branch: MAIN
Changes since 1.77: +172 -3 lines
Diff to previous 1.77 (colored)

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.

Revision 1.77 / (download) - annotate - [select for diffs], Sat Sep 5 16:45:33 2009 UTC (14 years, 7 months ago) by apb
Branch: MAIN
Changes since 1.76: +2 -2 lines
Diff to previous 1.76 (colored)

Change multiple spaces to tabs on one line

Revision 1.76 / (download) - annotate - [select for diffs], Fri Jul 10 20:02:21 2009 UTC (14 years, 9 months ago) by christos
Branch: MAIN
Changes since 1.75: +32 -1 lines
Diff to previous 1.75 (colored)

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 1.75 / (download) - annotate - [select for diffs], Tue Apr 28 03:03:52 2009 UTC (14 years, 11 months ago) by reed
Branch: MAIN
CVS Tags: jym-xensuspend-nbase, jym-xensuspend-base
Changes since 1.74: +5 -2 lines
Diff to previous 1.74 (colored)

Get rid of extra space in Usage statement.

Revision 1.74 / (download) - annotate - [select for diffs], Sat Dec 6 23:21:32 2008 UTC (15 years, 4 months ago) by salo
Branch: MAIN
CVS Tags: mjf-devfs2-base2
Branch point for: jym-xensuspend
Changes since 1.73: +19 -3 lines
Diff to previous 1.73 (colored)

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 1.73 / (download) - annotate - [select for diffs], Mon Jun 23 03:26:18 2008 UTC (15 years, 9 months ago) by dholland
Branch: MAIN
CVS Tags: wrstuden-revivesa-base-3, wrstuden-revivesa-base-2, netbsd-5-base, netbsd-5-1-RELEASE, netbsd-5-1-RC4, netbsd-5-1-RC3, netbsd-5-1-RC2, netbsd-5-1-RC1, 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, netbsd-5-1, netbsd-5-0-RELEASE, netbsd-5-0-RC4, netbsd-5-0-RC3, netbsd-5-0-RC2, netbsd-5-0-RC1, netbsd-5-0-2-RELEASE, netbsd-5-0-1-RELEASE, netbsd-5-0, mjf-devfs2-base, matt-nb5-pq3-base, matt-nb5-pq3, matt-nb5-mips64-u2-k2-k4-k7-k8-k9, matt-nb5-mips64-u1-k1-k5, matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-premerge-20091211, matt-nb5-mips64-k15, matt-nb5-mips64, matt-nb4-mips64-k7-u2a-k9b, matt-mips64-base2
Branch point for: netbsd-5
Changes since 1.72: +2 -2 lines
Diff to previous 1.72 (colored)

fix typo

Revision 1.72 / (download) - annotate - [select for diffs], Thu May 22 14:03:26 2008 UTC (15 years, 10 months ago) by he
Branch: MAIN
CVS Tags: yamt-pf42-base4, yamt-pf42-base3, wrstuden-revivesa-base-1, wrstuden-revivesa-base
Changes since 1.71: +8 -2 lines
Diff to previous 1.71 (colored)

Add support for optionally setting some environment variables before
starting ${command}, via ${name}_env.

Discussed with lukem.

Revision 1.71 / (download) - annotate - [select for diffs], Wed Apr 30 13:10:49 2008 UTC (15 years, 11 months ago) by martin
Branch: MAIN
CVS Tags: yamt-pf42-base2, hpcarm-cleanup-nbase
Branch point for: wrstuden-revivesa
Changes since 1.70: +1 -8 lines
Diff to previous 1.70 (colored)

Convert TNF licenses to new 2 clause variant

Revision 1.70 / (download) - annotate - [select for diffs], Mon Dec 31 15:31:40 2007 UTC (16 years, 3 months ago) by ad
Branch: MAIN
CVS Tags: yamt-pf42-baseX, yamt-pf42-base, mjf-devfs-base, matt-armv6-nbase, matt-armv6-base, keiichi-mipv6-base, keiichi-mipv6, hpcarm-cleanup-base
Branch point for: yamt-pf42, mjf-devfs2, mjf-devfs
Changes since 1.69: +2 -12 lines
Diff to previous 1.69 (colored)

Remove systrace. Ok core@.

Revision 1.69 / (download) - annotate - [select for diffs], Fri Apr 6 14:20:08 2007 UTC (17 years ago) by apb
Branch: MAIN
CVS Tags: matt-mips64-base, matt-mips64, matt-armv6-prevmlocking, hpcarm-cleanup, cube-autoconf-base, cube-autoconf
Branch point for: matt-armv6
Changes since 1.68: +16 -1 lines
Diff to previous 1.68 (colored)

* 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.

Revision 1.68 / (download) - annotate - [select for diffs], Sat Jan 27 14:30:26 2007 UTC (17 years, 2 months ago) by hubertf
Branch: MAIN
Changes since 1.67: +3 -3 lines
Diff to previous 1.67 (colored)

_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 1.67 / (download) - annotate - [select for diffs], Sat Oct 7 11:25:15 2006 UTC (17 years, 6 months ago) by elad
Branch: MAIN
CVS Tags: netbsd-4-base
Branch point for: netbsd-4
Changes since 1.66: +2 -2 lines
Diff to previous 1.66 (colored)

PR/32004: Ed Ravin: command interpreter test in rc.subr doesn't accomodate
chroots

Patch applied, thanks!

okay apb@

Revision 1.66 / (download) - annotate - [select for diffs], Sat Apr 1 10:05:50 2006 UTC (18 years ago) by he
Branch: MAIN
CVS Tags: abandoned-netbsd-4-base, abandoned-netbsd-4
Changes since 1.65: +6 -3 lines
Diff to previous 1.65 (colored)

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 1.65 / (download) - annotate - [select for diffs], Tue Oct 12 14:45:29 2004 UTC (19 years, 6 months ago) by lukem
Branch: MAIN
CVS Tags: netbsd-3-base, 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-0-3-RELEASE, netbsd-3-0-2-RELEASE, netbsd-3-0-1-RELEASE, netbsd-3-0
Branch point for: netbsd-3
Changes since 1.64: +23 -4 lines
Diff to previous 1.64 (colored)

* 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.

Revision 1.64 / (download) - annotate - [select for diffs], Fri Aug 13 18:08:03 2004 UTC (19 years, 8 months ago) by mycroft
Branch: MAIN
Changes since 1.63: +3 -1 lines
Diff to previous 1.63 (colored)

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

Revision 1.63 / (download) - annotate - [select for diffs], Mon May 3 14:52:26 2004 UTC (19 years, 11 months ago) by lukem
Branch: MAIN
Changes since 1.62: +6 -6 lines
Diff to previous 1.62 (colored)

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.

Revision 1.62 / (download) - annotate - [select for diffs], Fri Apr 2 13:13:47 2004 UTC (20 years ago) by jmmv
Branch: MAIN
Changes since 1.61: +4 -2 lines
Diff to previous 1.61 (colored)

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 1.61 / (download) - annotate - [select for diffs], Tue Jan 6 00:52:24 2004 UTC (20 years, 3 months ago) by lukem
Branch: MAIN
CVS Tags: netbsd-2-base, netbsd-2-0-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-3-RELEASE, netbsd-2-0-2-RELEASE, netbsd-2-0-1-RELEASE, netbsd-2-0
Branch point for: netbsd-2
Changes since 1.60: +17 -7 lines
Diff to previous 1.60 (colored)

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)".

Revision 1.60 / (download) - annotate - [select for diffs], Sat Jul 26 05:13:47 2003 UTC (20 years, 8 months ago) by lukem
Branch: MAIN
Changes since 1.59: +2 -2 lines
Diff to previous 1.59 (colored)

Add "*,v" to the list of scratch files to skip.
Suggested by Johnny Lam / Alistair Crooks

Revision 1.59 / (download) - annotate - [select for diffs], Fri Jul 4 14:14:10 2003 UTC (20 years, 9 months ago) by lukem
Branch: MAIN
Changes since 1.58: +1 -7 lines
Diff to previous 1.58 (colored)

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.

Revision 1.58 / (download) - annotate - [select for diffs], Fri Jun 27 05:01:21 2003 UTC (20 years, 9 months ago) by lukem
Branch: MAIN
Changes since 1.57: +7 -1 lines
Diff to previous 1.57 (colored)

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]

Revision 1.57 / (download) - annotate - [select for diffs], Fri Jun 27 04:06:01 2003 UTC (20 years, 9 months ago) by lukem
Branch: MAIN
Changes since 1.56: +2 -2 lines
Diff to previous 1.56 (colored)

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]

Revision 1.56 / (download) - annotate - [select for diffs], Tue Jun 3 14:00:45 2003 UTC (20 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.55: +4 -4 lines
Diff to previous 1.55 (colored)

Use more concise shell syntax:
1. for i in $* -> for i
2. foo=$* -> foo="$@"

Revision 1.55 / (download) - annotate - [select for diffs], Sun Jan 5 22:59:35 2003 UTC (21 years, 3 months ago) by lukem
Branch: MAIN
Changes since 1.54: +3 -1 lines
Diff to previous 1.54 (colored)

Fix logic error I introduced recently into mount_critical_filesystems().
Noted by kilbi@rad.rwth-aachen.de in [bin/19703].

Revision 1.54 / (download) - annotate - [select for diffs], Sun Jan 5 11:40:29 2003 UTC (21 years, 3 months ago) by lukem
Branch: MAIN
Changes since 1.53: +4 -2 lines
Diff to previous 1.53 (colored)

'if ! command;' is not POSIX sh, even though our /bin/sh supports it

Revision 1.53 / (download) - annotate - [select for diffs], Sat Jan 4 15:27:44 2003 UTC (21 years, 3 months ago) by lukem
Branch: MAIN
Changes since 1.52: +8 -8 lines
Diff to previous 1.52 (colored)

Change how internal boolean variables are used to:
	if ! ${_somevar:-false}; then
		_somevar=true
	fi
(Consisent, slightly quicker, and slightly cleaner)

Revision 1.52 / (download) - annotate - [select for diffs], Mon Aug 26 17:46:57 2002 UTC (21 years, 7 months ago) by abs
Branch: MAIN
CVS Tags: fvdl_fs64_base
Changes since 1.51: +2 -2 lines
Diff to previous 1.51 (colored)

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.

Revision 1.51 / (download) - annotate - [select for diffs], Thu Jul 25 14:34:46 2002 UTC (21 years, 8 months ago) by grant
Branch: MAIN
Changes since 1.50: +7 -3 lines
Diff to previous 1.50 (colored)

add test for /usr/bin/logger in warn/err.

Revision 1.50 / (download) - annotate - [select for diffs], Mon Jul 8 16:14:54 2002 UTC (21 years, 9 months ago) by atatat
Branch: MAIN
Changes since 1.49: +12 -2 lines
Diff to previous 1.49 (colored)

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 1.49 / (download) - annotate - [select for diffs], Tue May 21 12:31:01 2002 UTC (21 years, 11 months ago) by lukem
Branch: MAIN
CVS Tags: netbsd-1-6-base
Branch point for: netbsd-1-6
Changes since 1.48: +3 -1 lines
Diff to previous 1.48 (colored)

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").

Revision 1.48 / (download) - annotate - [select for diffs], Thu Apr 18 07:18:05 2002 UTC (22 years ago) by lukem
Branch: MAIN
Changes since 1.47: +5 -5 lines
Diff to previous 1.47 (colored)

consistently set rc_(fast|force)=yes

Revision 1.47 / (download) - annotate - [select for diffs], Wed Mar 27 08:53:42 2002 UTC (22 years ago) by lukem
Branch: MAIN
Changes since 1.46: +6 -9 lines
Diff to previous 1.46 (colored)

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!

Revision 1.46 / (download) - annotate - [select for diffs], Fri Mar 22 04:16:38 2002 UTC (22 years, 1 month ago) by lukem
Branch: MAIN
Changes since 1.45: +96 -77 lines
Diff to previous 1.45 (colored)

- 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].

Revision 1.45 / (download) - annotate - [select for diffs], Thu Mar 21 12:21:00 2002 UTC (22 years, 1 month ago) by lukem
Branch: MAIN
Changes since 1.44: +82 -38 lines
Diff to previous 1.44 (colored)

- 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.

Revision 1.44 / (download) - annotate - [select for diffs], Wed Mar 13 06:58:34 2002 UTC (22 years, 1 month ago) by lukem
Branch: MAIN
Changes since 1.43: +5 -2 lines
Diff to previous 1.43 (colored)

Use ${_arg}_postcmd even if we're not using the default ${_arg}_cmd method.

Revision 1.43 / (download) - annotate - [select for diffs], Wed Mar 13 04:50:08 2002 UTC (22 years, 1 month ago) by lukem
Branch: MAIN
Changes since 1.42: +41 -7 lines
Diff to previous 1.42 (colored)

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>.

Revision 1.42 / (download) - annotate - [select for diffs], Mon Feb 25 12:49:34 2002 UTC (22 years, 1 month ago) by lukem
Branch: MAIN
Changes since 1.41: +26 -11 lines
Diff to previous 1.41 (colored)

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.

Revision 1.41 / (download) - annotate - [select for diffs], Mon Feb 25 08:11:23 2002 UTC (22 years, 1 month ago) by lukem
Branch: MAIN
Changes since 1.40: +3 -3 lines
Diff to previous 1.40 (colored)

fix spelo.  crank copyright year

Revision 1.40 / (download) - annotate - [select for diffs], Mon Feb 25 07:12:47 2002 UTC (22 years, 1 month ago) by lukem
Branch: MAIN
Changes since 1.39: +3 -3 lines
Diff to previous 1.39 (colored)

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.

Revision 1.39 / (download) - annotate - [select for diffs], Mon Feb 25 06:58:14 2002 UTC (22 years, 1 month ago) by lukem
Branch: MAIN
Changes since 1.38: +19 -23 lines
Diff to previous 1.38 (colored)

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

Revision 1.38 / (download) - annotate - [select for diffs], Mon Nov 19 03:18:32 2001 UTC (22 years, 5 months ago) by lukem
Branch: MAIN
Changes since 1.37: +13 -1 lines
Diff to previous 1.37 (colored)

Add reverse_list(), which prints the reverse of the list of words.
Doesn't attempt to handle words with whitespace, etc.

Revision 1.37 / (download) - annotate - [select for diffs], Mon Jun 18 06:53:45 2001 UTC (22 years, 10 months ago) by lukem
Branch: MAIN
Changes since 1.36: +11 -5 lines
Diff to previous 1.36 (colored)

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].

Revision 1.36 / (download) - annotate - [select for diffs], Thu May 10 14:04:22 2001 UTC (22 years, 11 months ago) by atatat
Branch: MAIN
Changes since 1.35: +12 -7 lines
Diff to previous 1.35 (colored)

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.

Revision 1.35 / (download) - annotate - [select for diffs], Wed May 9 16:40:59 2001 UTC (22 years, 11 months ago) by lukem
Branch: MAIN
Changes since 1.34: +18 -13 lines
Diff to previous 1.34 (colored)

* 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 ?)

Revision 1.34 / (download) - annotate - [select for diffs], Mon May 7 07:07:11 2001 UTC (22 years, 11 months ago) by lukem
Branch: MAIN
Changes since 1.33: +13 -8 lines
Diff to previous 1.33 (colored)

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.

Revision 1.33 / (download) - annotate - [select for diffs], Wed Apr 18 01:31:40 2001 UTC (23 years ago) by lukem
Branch: MAIN
Changes since 1.32: +47 -6 lines
Diff to previous 1.32 (colored)

* 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.

Revision 1.32 / (download) - annotate - [select for diffs], Fri Apr 6 06:48:35 2001 UTC (23 years ago) by lukem
Branch: MAIN
Changes since 1.31: +3 -3 lines
Diff to previous 1.31 (colored)

clarify that ${name}_groups is comma separated

Revision 1.31 / (download) - annotate - [select for diffs], Wed Apr 4 03:17:19 2001 UTC (23 years ago) by atatat
Branch: MAIN
Changes since 1.30: +80 -1 lines
Diff to previous 1.30 (colored)

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.

Revision 1.30 / (download) - annotate - [select for diffs], Wed Feb 28 16:49:19 2001 UTC (23 years, 1 month ago) by lukem
Branch: MAIN
Changes since 1.29: +41 -34 lines
Diff to previous 1.29 (colored)

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

Revision 1.29 / (download) - annotate - [select for diffs], Fri Nov 17 03:47:43 2000 UTC (23 years, 5 months ago) by lukem
Branch: MAIN
Changes since 1.28: +17 -5 lines
Diff to previous 1.28 (colored)

* 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.

Revision 1.28 / (download) - annotate - [select for diffs], Mon Nov 6 00:08:30 2000 UTC (23 years, 5 months ago) by lukem
Branch: MAIN
Changes since 1.27: +2 -1 lines
Diff to previous 1.27 (colored)

when doing `status', return non-zero if the program isn't running.
request by thorpej.

Revision 1.27 / (download) - annotate - [select for diffs], Sun Nov 5 23:48:14 2000 UTC (23 years, 5 months ago) by lukem
Branch: MAIN
Changes since 1.26: +3 -3 lines
Diff to previous 1.26 (colored)

when running `forcerestart', call the underlying `stop' and `start'
with the `force' prefix as well

Revision 1.26 / (download) - annotate - [select for diffs], Sat Oct 7 07:36:56 2000 UTC (23 years, 6 months ago) by lukem
Branch: MAIN
Changes since 1.25: +3 -3 lines
Diff to previous 1.25 (colored)

use ${foo##*/} instead of `basename $foo`.  as suggested (with minor variation)
by Toru Nishimura <nisimura@itc.aist-nara.ac.jp>

Revision 1.25 / (download) - annotate - [select for diffs], Sun Oct 1 10:10:18 2000 UTC (23 years, 6 months ago) by lukem
Branch: MAIN
Changes since 1.24: +3 -3 lines
Diff to previous 1.24 (colored)

remove unnecessary leading `$' on warnings printed for $required_dirs
and $required_files.

Revision 1.24 / (download) - annotate - [select for diffs], Tue Sep 19 13:04:38 2000 UTC (23 years, 7 months ago) by lukem
Branch: MAIN
Changes since 1.23: +109 -58 lines
Diff to previous 1.23 (colored)

- 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

Revision 1.23 / (download) - annotate - [select for diffs], Sat Aug 19 08:47:43 2000 UTC (23 years, 8 months ago) by lukem
Branch: MAIN
Changes since 1.22: +3 -3 lines
Diff to previous 1.22 (colored)

support ${name}_nice even when using ${name}_chroot.  per discussion with mrg...

Revision 1.22 / (download) - annotate - [select for diffs], Thu Aug 17 11:07:10 2000 UTC (23 years, 8 months ago) by lukem
Branch: MAIN
Changes since 1.21: +20 -5 lines
Diff to previous 1.21 (colored)

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 :-]

Revision 1.21 / (download) - annotate - [select for diffs], Thu Jul 20 23:12:44 2000 UTC (23 years, 9 months ago) by lukem
Branch: MAIN
Changes since 1.20: +5 -5 lines
Diff to previous 1.20 (colored)

in err() and warn() put a : between the ERROR/WARNING label and the message

Revision 1.20 / (download) - annotate - [select for diffs], Fri Jun 9 14:27:57 2000 UTC (23 years, 10 months ago) by fvdl
Branch: MAIN
CVS Tags: netbsd-1-5-base
Branch point for: netbsd-1-5
Changes since 1.19: +4 -2 lines
Diff to previous 1.19 (colored)

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 1.19 / (download) - annotate - [select for diffs], Sat May 13 08:23:45 2000 UTC (23 years, 11 months ago) by lukem
Branch: MAIN
CVS Tags: minoura-xpg4dl-base
Branch point for: minoura-xpg4dl
Changes since 1.18: +17 -1 lines
Diff to previous 1.18 (colored)

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/*.

Revision 1.18 / (download) - annotate - [select for diffs], Sat May 13 03:07:17 2000 UTC (23 years, 11 months ago) by lukem
Branch: MAIN
Changes since 1.17: +20 -4 lines
Diff to previous 1.17 (colored)

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 :)

Revision 1.17 / (download) - annotate - [select for diffs], Sun Apr 30 13:16:47 2000 UTC (23 years, 11 months ago) by lukem
Branch: MAIN
Changes since 1.16: +14 -24 lines
Diff to previous 1.16 (colored)

- 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

Revision 1.16 / (download) - annotate - [select for diffs], Sun Apr 30 12:19:07 2000 UTC (23 years, 11 months ago) by lukem
Branch: MAIN
Changes since 1.15: +8 -8 lines
Diff to previous 1.15 (colored)

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.

Revision 1.15 / (download) - annotate - [select for diffs], Fri Apr 28 01:40:09 2000 UTC (23 years, 11 months ago) by lukem
Branch: MAIN
Changes since 1.14: +9 -5 lines
Diff to previous 1.14 (colored)

in check_pidfile and check_process, also match "(" + `basename prog` + ")" .
noted by veego@

Revision 1.14 / (download) - annotate - [select for diffs], Wed Apr 26 15:06:46 2000 UTC (23 years, 11 months ago) by lukem
Branch: MAIN
Changes since 1.13: +1 -5 lines
Diff to previous 1.13 (colored)

don't bother checking rc_configured each time run_rc_command executes; once in /etc/rc is enough

Revision 1.13 / (download) - annotate - [select for diffs], Sat Apr 22 03:01:22 2000 UTC (24 years ago) by lukem
Branch: MAIN
Changes since 1.12: +1 -7 lines
Diff to previous 1.12 (colored)

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).

Revision 1.12 / (download) - annotate - [select for diffs], Wed Apr 19 04:26:22 2000 UTC (24 years ago) by simonb
Branch: MAIN
Changes since 1.11: +7 -1 lines
Diff to previous 1.11 (colored)

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.

Revision 1.11 / (download) - annotate - [select for diffs], Fri Mar 10 11:39:27 2000 UTC (24 years, 1 month ago) by lukem
Branch: MAIN
Changes since 1.10: +437 -33 lines
Diff to previous 1.10 (colored)

* 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 1.10 / (download) - annotate - [select for diffs], Wed Jul 7 21:24:56 1999 UTC (24 years, 9 months ago) by drochner
Branch: MAIN
CVS Tags: wrstuden-devbsize-base, wrstuden-devbsize-19991221, wrstuden-devbsize, comdex-fall-1999-base, comdex-fall-1999
Changes since 1.9: +7 -5 lines
Diff to previous 1.9 (colored)

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...

Revision 1.9 / (download) - annotate - [select for diffs], Wed Apr 28 23:32:29 1999 UTC (24 years, 11 months ago) by nathanw
Branch: MAIN
Changes since 1.8: +2 -2 lines
Diff to previous 1.8 (colored)

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.

Revision 1.8 / (download) - annotate - [select for diffs], Tue Apr 13 02:15:49 1999 UTC (25 years ago) by cjs
Branch: MAIN
Changes since 1.7: +2 -4 lines
Diff to previous 1.7 (colored)

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 1.7 / (download) - annotate - [select for diffs], Thu Apr 1 03:58:44 1999 UTC (25 years ago) by cjs
Branch: MAIN
CVS Tags: netbsd-1-4-base
Branch point for: netbsd-1-4
Changes since 1.6: +31 -1 lines
Diff to previous 1.6 (colored)

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.

Revision 1.6 / (download) - annotate - [select for diffs], Wed Mar 24 18:59:47 1999 UTC (25 years ago) by mellon
Branch: MAIN
Changes since 1.5: +22 -1 lines
Diff to previous 1.5 (colored)

- Move critical filesystem mounting code into a shell function and put
  that in rc.subr.
- Support critfs_require_network rc.conf variable.

Revision 1.5 / (download) - annotate - [select for diffs], Sat Feb 28 22:56:11 1998 UTC (26 years, 1 month ago) by lukem
Branch: MAIN
Changes since 1.4: +6 -2 lines
Diff to previous 1.4 (colored)

improve description comment

Revision 1.4 / (download) - annotate - [select for diffs], Sat Feb 28 22:54:02 1998 UTC (26 years, 1 month ago) by lukem
Branch: MAIN
Changes since 1.3: +12 -7 lines
Diff to previous 1.3 (colored)

* 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)

Revision 1.3 / (download) - annotate - [select for diffs], Mon Jan 26 04:36:26 1998 UTC (26 years, 2 months ago) by lukem
Branch: MAIN
Changes since 1.2: +11 -7 lines
Diff to previous 1.2 (colored)

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 1.2 / (download) - annotate - [select for diffs], Sat Aug 30 03:34:29 1997 UTC (26 years, 7 months ago) by cjs
Branch: MAIN
CVS Tags: netbsd-1-3-base, netbsd-1-3-RELEASE, netbsd-1-3-PATCH003-CANDIDATE2, netbsd-1-3-PATCH003-CANDIDATE1, netbsd-1-3-PATCH003-CANDIDATE0, netbsd-1-3-PATCH003, netbsd-1-3-PATCH002, netbsd-1-3-PATCH001, netbsd-1-3-BETA, netbsd-1-3
Changes since 1.1: +1 -9 lines
Diff to previous 1.1 (colored)

Prune unused function.

Revision 1.1 / (download) - annotate - [select for diffs], Fri Aug 29 02:24:08 1997 UTC (26 years, 7 months ago) by cjs
Branch: MAIN

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.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>