]> CyberLeo.Net >> Repos - FreeBSD/releng/9.0.git/blob - share/man/man8/rc.subr.8
Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
[FreeBSD/releng/9.0.git] / share / man / man8 / rc.subr.8
1 .\"     $NetBSD: rc.subr.8,v 1.12 2004/01/06 00:52:24 lukem Exp $
2 .\"
3 .\" Copyright (c) 2002-2004 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
5 .\"
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Luke Mewburn.
8 .\"
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
11 .\" are met:
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\"    notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\"    notice, this list of conditions and the following disclaimer in the
16 .\"    documentation and/or other materials provided with the distribution.
17 .\"
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
29 .\"
30 .\" $FreeBSD$
31 .\"
32 .Dd May 18, 2007
33 .Dt RC.SUBR 8
34 .Os
35 .Sh NAME
36 .Nm rc.subr
37 .Nd functions used by system shell scripts
38 .Sh SYNOPSIS
39 .Bl -item -compact
40 .It
41 .Ic .\& Pa /etc/rc.subr
42 .Pp
43 .It
44 .Ic backup_file Ar action Ar file Ar current Ar backup
45 .It
46 .Ic checkyesno Ar var
47 .It
48 .Ic check_pidfile Ar pidfile Ar procname Op Ar interpreter
49 .It
50 .Ic check_process Ar procname Op Ar interpreter
51 .It
52 .Ic debug Ar message
53 .It
54 .Ic err Ar exitval Ar message
55 .It
56 .Ic force_depend Ar name
57 .It
58 .Ic info Ar message
59 .It
60 .Ic load_kld Oo Fl e Ar regex Oc Oo Fl m Ar module Oc Ar file
61 .It
62 .Ic load_rc_config Ar name
63 .It
64 .Ic load_rc_config_var Ar name Ar var
65 .It
66 .Ic mount_critical_filesystems Ar type
67 .It
68 .Ic rc_usage Ar command ...
69 .It
70 .Ic reverse_list Ar item ...
71 .It
72 .Ic run_rc_command Ar argument
73 .It
74 .Ic run_rc_script Ar file Ar argument
75 .It
76 .Ic set_rcvar Op Ar base
77 .It
78 .Ic wait_for_pids Op Ar pid ...
79 .It
80 .Ic warn Ar message
81 .El
82 .Sh DESCRIPTION
83 The
84 .Nm
85 script
86 contains commonly used shell script functions and variable
87 definitions which are used by various scripts such as
88 .Xr rc 8 .
89 Scripts required by ports in
90 .Pa /usr/local/etc/rc.d
91 will also eventually
92 be rewritten to make use of it.
93 .Pp
94 The
95 .Nm
96 functions were mostly imported from
97 .Nx .
98 .Pp
99 They are accessed by sourcing
100 .Pa /etc/rc.subr
101 into the current shell.
102 .Pp
103 The following shell functions are available:
104 .Bl -tag -width 4n
105 .It Ic backup_file Ar action file current backup
106 Make a backup copy of
107 .Ar file
108 into
109 .Ar current .
110 If the
111 .Xr rc.conf 5
112 variable
113 .Va backup_uses_rcs
114 is
115 .Dq Li YES ,
116 use
117 .Xr rcs 1
118 to archive the previous version of
119 .Ar current ,
120 otherwise save the previous version of
121 .Ar current
122 as
123 .Ar backup .
124 .Pp
125 The
126 .Ar action
127 argument
128 may be one of the following:
129 .Bl -tag -width ".Cm remove"
130 .It Cm add
131 .Ar file
132 is now being backed up by or possibly re-entered into this backup mechanism.
133 .Ar current
134 is created, and if necessary, the
135 .Xr rcs 1
136 files are created as well.
137 .It Cm update
138 .Ar file
139 has changed and needs to be backed up.
140 If
141 .Ar current
142 exists, it is copied to
143 .Ar backup
144 or checked into
145 .Xr rcs 1
146 (if the repository file is old),
147 and then
148 .Ar file
149 is copied to
150 .Ar current .
151 .It Cm remove
152 .Ar file
153 is no longer being tracked by this backup mechanism.
154 If
155 .Xr rcs 1
156 is being used, an empty file is checked in and
157 .Ar current
158 is removed,
159 otherwise
160 .Ar current
161 is moved to
162 .Ar backup .
163 .El
164 .It Ic checkyesno Ar var
165 Return 0 if
166 .Ar var
167 is defined to
168 .Dq Li YES ,
169 .Dq Li TRUE ,
170 .Dq Li ON ,
171 or
172 .Ql 1 .
173 Return 1 if
174 .Ar var
175 is defined to
176 .Dq Li NO ,
177 .Dq Li FALSE ,
178 .Dq Li OFF ,
179 or
180 .Ql 0 .
181 Otherwise, warn that
182 .Ar var
183 is not set correctly.
184 The values are case insensitive.
185 .Sy Note :
186 .Ar var
187 should be a variable name, not its value;
188 .Ic checkyesno
189 will expand the variable by itself.
190 .It Ic check_pidfile Ar pidfile procname Op Ar interpreter
191 Parses the first word of the first line of
192 .Ar pidfile
193 for a PID, and ensures that the process with that PID
194 is running and its first argument matches
195 .Ar procname .
196 Prints the matching PID if successful, otherwise nothing.
197 If
198 .Ar interpreter
199 is provided, parse the first line of
200 .Ar procname ,
201 ensure that the line is of the form:
202 .Pp
203 .Dl "#! interpreter [...]"
204 .Pp
205 and use
206 .Ar interpreter
207 with its optional arguments and
208 .Ar procname
209 appended as the process string to search for.
210 .It Ic check_process Ar procname Op Ar interpreter
211 Prints the PIDs of any processes that are running with a first
212 argument that matches
213 .Ar procname .
214 .Ar interpreter
215 is handled as per
216 .Ic check_pidfile .
217 .It Ic debug Ar message
218 Display a debugging message to
219 .Va stderr ,
220 log it to the system log using
221 .Xr logger 1 ,
222 and
223 return to the caller.
224 The error message consists of the script name
225 (from
226 .Va $0 ) ,
227 followed by
228 .Dq Li ": DEBUG: " ,
229 and then
230 .Ar message .
231 This function is intended to be used by developers
232 as an aid to debugging scripts.
233 It can be turned on or off
234 by the
235 .Xr rc.conf 5
236 variable
237 .Va rc_debug .
238 .It Ic err Ar exitval message
239 Display an error message to
240 .Va stderr ,
241 log it to the system log
242 using
243 .Xr logger 1 ,
244 and
245 .Ic exit
246 with an exit value of
247 .Ar exitval .
248 The error message consists of the script name
249 (from
250 .Va $0 ) ,
251 followed by
252 .Dq Li ": ERROR: " ,
253 and then
254 .Ar message .
255 .It Ic force_depend Ar name
256 Output an advisory message and force the
257 .Ar name
258 service to start.
259 The
260 .Ar name
261 argument is the
262 .Xr basename 1
263 component of the path to the script, usually
264 .Pa /etc/rc.d/name .
265 If the script fails for any reason it will output a warning
266 and return with a return value of 1.
267 If it was successful
268 it will return 0.
269 .It Ic info Ar message
270 Display an informational message to
271 .Va stdout ,
272 and log it to the system log using
273 .Xr logger 1 .
274 The message consists of the script name
275 (from
276 .Va $0 ) ,
277 followed by
278 .Dq Li ": INFO: " ,
279 and then
280 .Ar message .
281 The display of this informational output can be
282 turned on or off by the
283 .Xr rc.conf 5
284 variable
285 .Va rc_info .
286 .It Ic load_kld Oo Fl e Ar regex Oc Oo Fl m Ar module Oc Ar file
287 Load
288 .Ar file
289 as a kernel module unless it is already loaded.
290 For the purpose of checking the module status,
291 either the exact module name can be specified using
292 .Fl m ,
293 or an
294 .Xr egrep 1
295 regular expression matching the module name can be supplied via
296 .Fl e .
297 By default, the module is assumed to have the same name as
298 .Ar file ,
299 which is not always the case.
300 .It Ic load_rc_config Ar name
301 Source in the configuration files for
302 .Ar name .
303 First,
304 .Pa /etc/rc.conf
305 is sourced if it has not yet been read in.
306 Then,
307 .Pa /etc/rc.conf.d/ Ns Ar name
308 is sourced if it is an existing file.
309 The latter may also contain other variable assignments to override
310 .Ic run_rc_command
311 arguments defined by the calling script, to provide an easy
312 mechanism for an administrator to override the behaviour of a given
313 .Xr rc.d 8
314 script without requiring the editing of that script.
315 .It Ic load_rc_config_var Ar name Ar var
316 Read the
317 .Xr rc.conf 5
318 variable
319 .Ar var
320 for
321 .Ar name
322 and set in the current shell, using
323 .Ic load_rc_config
324 in a sub-shell to prevent unwanted side effects from other variable
325 assignments.
326 .It Ic mount_critical_filesystems Ar type
327 Go through a list of critical file systems,
328 as found in the
329 .Xr rc.conf 5
330 variable
331 .Va critical_filesystems_ Ns Ar type ,
332 mounting each one that
333 is not currently mounted.
334 .It Ic rc_usage Ar command ...
335 Print a usage message for
336 .Va $0 ,
337 with
338 .Ar commands
339 being the list of valid arguments
340 prefixed by
341 .Sm off
342 .Dq Bq Li fast | force | one .
343 .Sm on
344 .It Ic reverse_list Ar item ...
345 Print the list of
346 .Ar items
347 in reverse order.
348 .It Ic run_rc_command Ar argument
349 Run the
350 .Ar argument
351 method for the current
352 .Xr rc.d 8
353 script, based on the settings of various shell variables.
354 .Ic run_rc_command
355 is extremely flexible, and allows fully functional
356 .Xr rc.d 8
357 scripts to be implemented in a small amount of shell code.
358 .Pp
359 .Ar argument
360 is searched for in the list of supported commands, which may be one
361 of:
362 .Bl -tag -width ".Cm restart" -offset indent
363 .It Cm start
364 Start the service.
365 This should check that the service is to be started as specified by
366 .Xr rc.conf 5 .
367 Also checks if the service is already running and refuses to start if
368 it is.
369 This latter check is not performed by standard
370 .Fx
371 scripts if the system is starting directly to multi-user mode, to
372 speed up the boot process.
373 .It Cm stop
374 If the service is to be started as specified by
375 .Xr rc.conf 5 ,
376 stop the service.
377 This should check that the service is running and complain if it is not.
378 .It Cm restart
379 Perform a
380 .Cm stop
381 then a
382 .Cm start .
383 Defaults to displaying the process ID of the program (if running).
384 .It Cm rcvar
385 Display which
386 .Xr rc.conf 5
387 variables are used to control the startup of the service (if any).
388 .El
389 .Pp
390 If
391 .Va pidfile
392 or
393 .Va procname
394 is set, also support:
395 .Bl -tag -width ".Cm restart" -offset indent
396 .It Cm poll
397 Wait for the command to exit.
398 .It Cm status
399 Show the status of the process.
400 .El
401 .Pp
402 Other supported commands are listed in the optional variable
403 .Va extra_commands .
404 .Pp
405 .Ar argument
406 may have one of the following prefixes which alters its operation:
407 .Bl -tag -width ".Li force" -offset indent
408 .It Li fast
409 Skip the check for an existing running process,
410 and sets
411 .Va rc_fast Ns = Ns Li YES .
412 .It Li force
413 Skip the checks for
414 .Va rcvar
415 being set to
416 .Dq Li YES ,
417 and sets
418 .Va rc_force Ns = Ns Li YES .
419 This ignores
420 .Ar argument Ns Va _precmd
421 returning non-zero, and ignores any of the
422 .Va required_*
423 tests failing, and always returns a zero exit status.
424 .It Li one
425 Skip the checks for
426 .Va rcvar
427 being set to
428 .Dq Li YES ,
429 but performs all the other prerequisite tests.
430 .El
431 .Pp
432 .Ic run_rc_command
433 uses the following shell variables to control its behaviour.
434 Unless otherwise stated, these are optional.
435 .Bl -tag -width ".Va procname" -offset indent
436 .It Va name
437 The name of this script.
438 This is not optional.
439 .It Va rcvar
440 The value of
441 .Va rcvar
442 is checked with
443 .Ic checkyesno
444 to determine if this method should be run.
445 .It Va command
446 Full path to the command.
447 Not required if
448 .Ar argument Ns Va _cmd
449 is defined for each supported keyword.
450 Can be overridden by
451 .Va ${name}_program .
452 .It Va command_args
453 Optional arguments and/or shell directives for
454 .Va command .
455 .It Va command_interpreter
456 .Va command
457 is started with:
458 .Pp
459 .Dl "#! command_interpreter [...]"
460 .Pp
461 which results in its
462 .Xr ps 1
463 command being:
464 .Pp
465 .Dl "command_interpreter [...] command"
466 .Pp
467 so use that string to find the PID(s) of the running command
468 rather than
469 .Va command .
470 .It Va extra_commands
471 Extra commands/keywords/arguments supported.
472 .It Va pidfile
473 Path to PID file.
474 Used to determine the PID(s) of the running command.
475 If
476 .Va pidfile
477 is set, use:
478 .Pp
479 .Dl "check_pidfile $pidfile $procname"
480 .Pp
481 to find the PID.
482 Otherwise, if
483 .Va command
484 is set, use:
485 .Pp
486 .Dl "check_process $procname"
487 .Pp
488 to find the PID.
489 .It Va procname
490 Process name to check for.
491 Defaults to the value of
492 .Va command .
493 .It Va required_dirs
494 Check for the existence of the listed directories
495 before running the
496 .Cm start
497 method.
498 .It Va required_files
499 Check for the readability of the listed files
500 before running the
501 .Cm start
502 method.
503 .It Va required_modules
504 Ensure that the listed kernel modules are loaded
505 before running the
506 .Cm start
507 method.
508 This is done after invoking the commands from
509 .Va start_precmd
510 so that the missing modules are not loaded in vain
511 if the preliminary commands indicate a error condition.
512 A word in the list can have an optional
513 .Dq Li : Ns Ar modname
514 or
515 .Dq Li ~ Ns Ar pattern
516 suffix.
517 The
518 .Ar modname
519 or
520 .Ar pattern
521 parameter is passed to
522 .Ic load_kld
523 through a
524 .Fl m
525 or
526 .Fl e
527 option, respectively.
528 See the description of
529 .Ic load_kld
530 in this document for details.
531 .It Va required_vars
532 Perform
533 .Ic checkyesno
534 on each of the list variables
535 before running the
536 .Cm start
537 method.
538 .It Va ${name}_chdir
539 Directory to
540 .Ic cd
541 to before running
542 .Va command ,
543 if
544 .Va ${name}_chroot
545 is not provided.
546 .It Va ${name}_chroot
547 Directory to
548 .Xr chroot 8
549 to before running
550 .Va command .
551 Only supported after
552 .Pa /usr
553 is mounted.
554 .It Va ${name}_flags
555 Arguments to call
556 .Va command
557 with.
558 This is usually set in
559 .Xr rc.conf 5 ,
560 and not in the
561 .Xr rc.d 8
562 script.
563 The environment variable
564 .Sq Ev flags
565 can be used to override this.
566 .It Va ${name}_nice
567 .Xr nice 1
568 level to run
569 .Va command
570 as.
571 Only supported after
572 .Pa /usr
573 is mounted.
574 .It Va ${name}_program
575 Full path to the command.
576 Overrides
577 .Va command
578 if both are set, but has no effect if
579 .Va command
580 is unset.
581 As a rule,
582 .Va command
583 should be set in the script while
584 .Va ${name}_program
585 should be set in
586 .Xr rc.conf 5 .
587 .It Va ${name}_user
588 User to run
589 .Va command
590 as, using
591 .Xr chroot 8
592 if
593 .Va ${name}_chroot
594 is set, otherwise
595 uses
596 .Xr su 1 .
597 Only supported after
598 .Pa /usr
599 is mounted.
600 .It Va ${name}_group
601 Group to run the chrooted
602 .Va command
603 as.
604 .It Va ${name}_groups
605 Comma separated list of supplementary groups to run the chrooted
606 .Va command
607 with.
608 .It Ar argument Ns Va _cmd
609 Shell commands which override the default method for
610 .Ar argument .
611 .It Ar argument Ns Va _precmd
612 Shell commands to run just before running
613 .Ar argument Ns Va _cmd
614 or the default method for
615 .Ar argument .
616 If this returns a non-zero exit code, the main method is not performed.
617 If the default method is being executed, this check is performed after
618 the
619 .Va required_*
620 checks and process (non-)existence checks.
621 .It Ar argument Ns Va _postcmd
622 Shell commands to run if running
623 .Ar argument Ns Va _cmd
624 or the default method for
625 .Ar argument
626 returned a zero exit code.
627 .It Va sig_stop
628 Signal to send the processes to stop in the default
629 .Cm stop
630 method.
631 Defaults to
632 .Dv SIGTERM .
633 .It Va sig_reload
634 Signal to send the processes to reload in the default
635 .Cm reload
636 method.
637 Defaults to
638 .Dv SIGHUP .
639 .El
640 .Pp
641 For a given method
642 .Ar argument ,
643 if
644 .Ar argument Ns Va _cmd
645 is not defined, then a default method is provided by
646 .Ic run_rc_command :
647 .Bl -tag -width ".Sy Argument" -offset indent
648 .It Sy Argument
649 .Sy Default method
650 .It Cm start
651 If
652 .Va command
653 is not running and
654 .Ic checkyesno Va rcvar
655 succeeds, start
656 .Va command .
657 .It Cm stop
658 Determine the PIDs of
659 .Va command
660 with
661 .Ic check_pidfile
662 or
663 .Ic check_process
664 (as appropriate),
665 .Ic kill Va sig_stop
666 those PIDs, and run
667 .Ic wait_for_pids
668 on those PIDs.
669 .It Cm reload
670 Similar to
671 .Cm stop ,
672 except that it uses
673 .Va sig_reload
674 instead, and does not run
675 .Ic wait_for_pids .
676 Another difference from
677 .Cm stop
678 is that
679 .Cm reload
680 is not provided by default.
681 It can be enabled via
682 .Va extra_commands
683 if appropriate:
684 .Pp
685 .Dl "extra_commands=reload"
686 .It Cm restart
687 Runs the
688 .Cm stop
689 method, then the
690 .Cm start
691 method.
692 .It Cm status
693 Show the PID of
694 .Va command ,
695 or some other script specific status operation.
696 .It Cm poll
697 Wait for
698 .Va command
699 to exit.
700 .It Cm rcvar
701 Display which
702 .Xr rc.conf 5
703 variable is used (if any).
704 This method always works, even if the appropriate
705 .Xr rc.conf 5
706 variable is set to
707 .Dq Li NO .
708 .El
709 .Pp
710 The following variables are available to the methods
711 (such as
712 .Ar argument Ns Va _cmd )
713 as well as after
714 .Ic run_rc_command
715 has completed:
716 .Bl -tag -width ".Va rc_flags" -offset indent
717 .It Va rc_arg
718 Argument provided to
719 .Ic run_rc_command ,
720 after fast and force processing has been performed.
721 .It Va rc_flags
722 Flags to start the default command with.
723 Defaults to
724 .Va ${name}_flags ,
725 unless overridden by the environment variable
726 .Sq Ev flags .
727 This variable may be changed by the
728 .Ar argument Ns Va _precmd
729 method.
730 .It Va rc_pid
731 PID of
732 .Va command
733 (if appropriate).
734 .It Va rc_fast
735 Not empty if
736 .Dq Li fast
737 prefix was used.
738 .It Va rc_force
739 Not empty if
740 .Dq Li force
741 prefix was used.
742 .El
743 .It Ic run_rc_script Ar file argument
744 Start the script
745 .Ar file
746 with an argument of
747 .Ar argument ,
748 and handle the return value from the script.
749 .Pp
750 Various shell variables are unset before
751 .Ar file
752 is started:
753 .Bd -ragged -offset indent
754 .Va name ,
755 .Va command ,
756 .Va command_args ,
757 .Va command_interpreter ,
758 .Va extra_commands ,
759 .Va pidfile ,
760 .Va rcvar ,
761 .Va required_dirs ,
762 .Va required_files ,
763 .Va required_vars ,
764 .Ar argument Ns Va _cmd ,
765 .Ar argument Ns Va _precmd .
766 .Ar argument Ns Va _postcmd .
767 .Ed
768 .Pp
769 The startup behaviour of
770 .Ar file
771 depends upon the following checks:
772 .Bl -enum
773 .It
774 If
775 .Ar file
776 ends in
777 .Pa .sh ,
778 it is sourced into the current shell.
779 .It
780 If
781 .Ar file
782 appears to be a backup or scratch file
783 (e.g., with a suffix of
784 .Pa ~ , # , .OLD ,
785 or
786 .Pa .orig ) ,
787 ignore it.
788 .It
789 If
790 .Ar file
791 is not executable, ignore it.
792 .It
793 If the
794 .Xr rc.conf 5
795 variable
796 .Va rc_fast_and_loose
797 is empty,
798 source
799 .Ar file
800 in a sub shell,
801 otherwise source
802 .Ar file
803 into the current shell.
804 .El
805 .It Ic stop_boot Op Ar always
806 Prevent booting to multiuser mode.
807 If the
808 .Va autoboot
809 variable is set to
810 .Ql yes ,
811 or
812 .Ic checkyesno Ar always
813 indicates a truth value, then a
814 .Dv SIGTERM
815 signal is sent to the parent
816 process, which is assumed to be
817 .Xr rc 8 .
818 Otherwise, the shell exits with a non-zero status.
819 .It Ic set_rcvar Op Ar base
820 Set the variable name required to start a service.
821 In
822 .Fx
823 a daemon is usually controlled by an
824 .Xr rc.conf 5
825 variable consisting of a daemon's name postfixed by the string
826 .Dq Li "_enable" .
827 This is not the case in
828 .Nx .
829 When the following line is included in a script:
830 .Pp
831 .Dl "rcvar=`set_rcvar`"
832 .Pp
833 this function will use the value of the
834 .Va $name
835 variable, which should be defined by the calling script,
836 to construct the appropriate
837 .Xr rc.conf 5
838 knob.
839 If the
840 .Ar base
841 argument is set it will use
842 .Ar base
843 instead of
844 .Va $name .
845 .It Ic wait_for_pids Op Ar pid ...
846 Wait until all of the provided
847 .Ar pids
848 do not exist any more, printing the list of outstanding
849 .Ar pids
850 every two seconds.
851 .It Ic warn Ar message
852 Display a warning message to
853 .Va stderr
854 and log it to the system log
855 using
856 .Xr logger 1 .
857 The warning message consists of the script name
858 (from
859 .Va $0 ) ,
860 followed by
861 .Dq Li ": WARNING: " ,
862 and then
863 .Ar message .
864 .El
865 .Sh FILES
866 .Bl -tag -width ".Pa /etc/rc.subr" -compact
867 .It Pa /etc/rc.subr
868 The
869 .Nm
870 file resides in
871 .Pa /etc .
872 .El
873 .Sh SEE ALSO
874 .Xr rc.conf 5 ,
875 .Xr rc 8
876 .Sh HISTORY
877 The
878 .Nm
879 script
880 appeared in
881 .Nx 1.3 .
882 The
883 .Xr rc.d 8
884 support functions appeared in
885 .Nx 1.5 .
886 The
887 .Nm
888 script
889 first appeared in
890 .Fx 5.0 .