rc.8 (107143) | rc.8 (107383) |
---|---|
1.\" Copyright (c) 1980, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Portions of this manual page are Copyrighted by 5.\" The NetBSD Foundation. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions --- 19 unchanged lines hidden (view full) --- 28.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33.\" SUCH DAMAGE. 34.\" 35.\" @(#)rc.8 8.2 (Berkeley) 12/11/93 | 1.\" Copyright (c) 1980, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Portions of this manual page are Copyrighted by 5.\" The NetBSD Foundation. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions --- 19 unchanged lines hidden (view full) --- 28.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33.\" SUCH DAMAGE. 34.\" 35.\" @(#)rc.8 8.2 (Berkeley) 12/11/93 |
36.\" $FreeBSD: head/share/man/man8/rc.8 107143 2002-11-21 20:12:05Z gordon $ | 36.\" $FreeBSD: head/share/man/man8/rc.8 107383 2002-11-29 11:39:20Z ru $ |
37.\" 38.Dd November 4, 2002 39.Dt RC 8 40.Os 41.Sh NAME 42.Nm rc | 37.\" 38.Dd November 4, 2002 39.Dt RC 8 40.Os 41.Sh NAME 42.Nm rc |
43.Nd command scripts for auto\-reboot and daemon startup | 43.Nd command scripts for auto-reboot and daemon startup |
44.Sh SYNOPSIS 45.Nm | 44.Sh SYNOPSIS 45.Nm |
46.Nm rc.d/ 47.Nm rc.d/atm* 48.Nm rc.d/network* 49.Nm rc.d/pccard 50.Nm rc.d/serial | |
51.Nm rc.conf 52.Nm rc.conf.local | 46.Nm rc.conf 47.Nm rc.conf.local |
48.Nm rc.d/ |
|
53.Nm rc.firewall 54.Nm rc.local 55.Nm rc.shutdown 56.Nm rc.subr 57.Sh DESCRIPTION 58The 59.Nm 60utility is the command script which controls the automatic boot process 61after being called by 62.Xr init 8 . 63The 64.Nm rc.local 65script contains commands which are pertinent only | 49.Nm rc.firewall 50.Nm rc.local 51.Nm rc.shutdown 52.Nm rc.subr 53.Sh DESCRIPTION 54The 55.Nm 56utility is the command script which controls the automatic boot process 57after being called by 58.Xr init 8 . 59The 60.Nm rc.local 61script contains commands which are pertinent only |
66to a specific site. Typically, the 67.Nm /usr/local/etc/rc.d | 62to a specific site. 63Typically, the 64.Pa /usr/local/etc/rc.d/ |
68mechanism is used instead of 69.Nm rc.local 70these days but if 71you want to use | 65mechanism is used instead of 66.Nm rc.local 67these days but if 68you want to use |
72.Nm rc.local 73it is still supported. In this case it should source 74.Nm /etc/rc.conf | 69.Nm rc.local , 70it is still supported. 71In this case, it should source 72.Pa /etc/rc.conf |
75and contain additional custom startup code for your system. 76The best way to handle | 73and contain additional custom startup code for your system. 74The best way to handle |
77.Nm rc.local ; | 75.Nm rc.local , |
78however, is to separate it out into | 76however, is to separate it out into |
79.Nm /etc/rc.d 80style scripts and place them in 81.Nm /usr/local/etc/rc.d . | 77.Nm rc.d/ 78style scripts and place them under 79.Pa /usr/local/etc/rc.d/ . |
82The 83.Nm rc.conf 84file contains the global system configuration information referenced 85by the startup scripts, while 86.Nm rc.conf.local 87contains the local system configuration. 88See 89.Xr rc.conf 5 90for more information. 91.Pp 92The | 80The 81.Nm rc.conf 82file contains the global system configuration information referenced 83by the startup scripts, while 84.Nm rc.conf.local 85contains the local system configuration. 86See 87.Xr rc.conf 5 88for more information. 89.Pp 90The |
93.Nm rc.d | 91.Nm rc.d/ |
94directories contain scripts which will be automatically 95executed at boot time and shutdown time. | 92directories contain scripts which will be automatically 93executed at boot time and shutdown time. |
96.Ss Operation of rc | 94.Ss Operation of Nm |
97.Bl -enum 98.It 99Source 100.Pa /etc/rc.subr 101to load various 102.Xr rc.subr 8 103shell functions to use. 104.It 105If autobooting, set | 95.Bl -enum 96.It 97Source 98.Pa /etc/rc.subr 99to load various 100.Xr rc.subr 8 101shell functions to use. 102.It 103If autobooting, set |
106.Sy autoboot=yes | 104.Va autoboot Ns = Ns Li yes |
107and enable a flag | 105and enable a flag |
108.Sy ( rc_fast=yes ) , | 106.Pq Va rc_fast Ns = Ns Li yes , |
109which prevents the | 107which prevents the |
110.Nm rc.d | 108.Nm rc.d/ |
111scripts from performing the check for already running processes 112(thus speeding up the boot process). 113This | 109scripts from performing the check for already running processes 110(thus speeding up the boot process). 111This |
114.Sy rc_fast=yes 115speedup won't occur when | 112.Va rc_fast Ns = Ns Li yes 113speedup will not occur when |
116.Nm 117is started up after exiting the single-user shell. 118.It 119Invoke 120.Xr rcorder 8 121to order the files in 122.Pa /etc/rc.d/ 123that do not have a | 114.Nm 115is started up after exiting the single-user shell. 116.It 117Invoke 118.Xr rcorder 8 119to order the files in 120.Pa /etc/rc.d/ 121that do not have a |
124.Dq nostart | 122.Dq Li nostart |
125keyword (refer to | 123keyword (refer to |
126.Xr rcorder 8 's | 124.Xr rcorder 8 Ns 's |
127.Fl s 128flag), | 125.Fl s 126flag), |
129and assigns the result to a variable. | 127and assign the result to a variable. |
130.It | 128.It |
131Calls each script in turn using run_rc_script() (from | 129Call each script in turn using 130.Fn run_rc_script 131(from |
132.Xr rc.subr 8 ) , 133which sets | 132.Xr rc.subr 8 ) , 133which sets |
134.Dv $1 | 134.Va $1 |
135to | 135to |
136.Sq start , | 136.Dq Li start , |
137and sources the script in a subshell. 138If the script has a | 137and sources the script in a subshell. 138If the script has a |
139.Sq .sh | 139.Pa .sh |
140suffix then it is sourced directly into the current shell. 141.El | 140suffix then it is sourced directly into the current shell. 141.El |
142.Ss Operation of rc.shutdown | 142.Ss Operation of Nm rc.shutdown |
143.Bl -enum 144.It 145Source 146.Pa /etc/rc.subr 147to load various 148.Xr rc.subr 8 149shell functions to use. 150.It 151Invoke 152.Xr rcorder 8 153to order the files in 154.Pa /etc/rc.d/ 155that have a | 143.Bl -enum 144.It 145Source 146.Pa /etc/rc.subr 147to load various 148.Xr rc.subr 8 149shell functions to use. 150.It 151Invoke 152.Xr rcorder 8 153to order the files in 154.Pa /etc/rc.d/ 155that have a |
156.Dq shutdown | 156.Dq Li shutdown |
157keyword (refer to | 157keyword (refer to |
158.Xr rcorder 8 's | 158.Xr rcorder 8 Ns 's |
159.Fl k 160flag), | 159.Fl k 160flag), |
161reverses that order, and assigns the result to a variable. | 161reverse that order, and assign the result to a variable. |
162.It | 162.It |
163Calls each script in turn using run_rc_script() (from | 163Call each script in turn using 164.Fn run_rc_script 165(from |
164.Xr rc.subr 8 ) , 165which sets | 166.Xr rc.subr 8 ) , 167which sets |
166.Dv $1 | 168.Va $1 |
167to | 169to |
168.Sq stop , | 170.Dq Li stop , |
169and sources the script in a subshell. 170If the script has a | 171and sources the script in a subshell. 172If the script has a |
171.Sq .sh | 173.Pa .sh |
172suffix then it is sourced directly into the current shell. 173.El | 174suffix then it is sourced directly into the current shell. 175.El |
174.Ss Contents of rc.d/ | 176.Ss Contents of Nm rc.d/ |
175.Nm rc.d/ 176is located in | 177.Nm rc.d/ 178is located in |
177.Pa /etc/rc.d . | 179.Pa /etc/rc.d/ . |
178The following file naming conventions are currently used in 179.Nm rc.d/ : | 180The following file naming conventions are currently used in 181.Nm rc.d/ : |
180.Bl -tag -width ALLUPPERCASExx -offset indent | 182.Bl -tag -width ".Pa ALLUPPERCASE" -offset indent |
181.It Pa ALLUPPERCASE 182Scripts that are | 183.It Pa ALLUPPERCASE 184Scripts that are |
183.Sq placeholders | 185.Dq placeholders |
184to ensure that certain operations are performed before others. 185In order of startup, these are: | 186to ensure that certain operations are performed before others. 187In order of startup, these are: |
186.Bl -tag -width NETWORKINGxx | 188.Bl -tag -width ".Pa NETWORKING" |
187.It Pa NETWORKING 188Ensure basic network services are running, including general | 189.It Pa NETWORKING 190Ensure basic network services are running, including general |
189network configuration ( 190.Pa network1, 191.Pa network2 192.Pa network3 ) . | 191network configuration 192.Pq Pa network1 , network2 , network3 . |
193.It Pa SERVERS 194Ensure basic services (such as | 193.It Pa SERVERS 194Ensure basic services (such as |
195.Pa NETWORKING , 196.Pa ppp-user , 197.Pa syslogd , | 195.Pa NETWORKING , ppp-user , syslogd , |
198and 199.Pa isdnd ) 200exist for services that start early (such as 201.Pa named ) , | 196and 197.Pa isdnd ) 198exist for services that start early (such as 199.Pa named ) , |
202because they're required by | 200because they are required by |
203.Pa DAEMON 204below. 205.It Pa DAEMON 206Check-point before all general purpose daemons such as 207.Pa lpd 208and 209.Pa ntpd . 210.It Pa LOGIN --- 4 unchanged lines hidden (view full) --- 215as well as services which might run commands as users 216.Pa ( cron 217and 218.Pa sendmail ) . 219.El 220.It Pa foo.sh 221Scripts that are to be sourced into the current shell rather than a subshell 222have a | 201.Pa DAEMON 202below. 203.It Pa DAEMON 204Check-point before all general purpose daemons such as 205.Pa lpd 206and 207.Pa ntpd . 208.It Pa LOGIN --- 4 unchanged lines hidden (view full) --- 213as well as services which might run commands as users 214.Pa ( cron 215and 216.Pa sendmail ) . 217.El 218.It Pa foo.sh 219Scripts that are to be sourced into the current shell rather than a subshell 220have a |
223.Sq Pa .sh | 221.Pa .sh |
224suffix. 225Extreme care must be taken in using this, as the startup sequence will 226terminate if the script does. 227.It Pa bar 228Scripts that are sourced in a subshell. 229These can stop the boot if necessary with the following shell 230commands: | 222suffix. 223Extreme care must be taken in using this, as the startup sequence will 224terminate if the script does. 225.It Pa bar 226Scripts that are sourced in a subshell. 227These can stop the boot if necessary with the following shell 228commands: |
231.Bd -literal -offset 232 if [ "$autoboot" = yes ]; then 233 kill -TERM $$ 234 fi 235 exit 1 | 229.Bd -literal -offset indent 230if [ "$autoboot" = yes ]; then 231 kill -TERM $$ 232fi 233exit 1 |
236.Ed 237.Pp 238Note that this should be used extremely sparingly! 239.El 240.Pp 241Each script should contain 242.Xr rcorder 8 243keywords, especially an appropriate | 234.Ed 235.Pp 236Note that this should be used extremely sparingly! 237.El 238.Pp 239Each script should contain 240.Xr rcorder 8 241keywords, especially an appropriate |
244.Dq PROVIDE | 242.Dq Li PROVIDE |
245entry, and if necessary | 243entry, and if necessary |
246.Dq REQUIRE | 244.Dq Li REQUIRE |
247and | 245and |
248.Dq BEFORE 249keywords. In addition, all scripts must have a 250.Dq # KEYWORD: FreeBSD | 246.Dq Li BEFORE 247keywords. 248In addition, all scripts must have a 249.Dq Li "# KEYWORD: FreeBSD" |
251line. 252.Pp 253Each script is expected to support at least the following arguments, which | 250line. 251.Pp 252Each script is expected to support at least the following arguments, which |
254are automatically supported if it uses the run_rc_command() function. 255.Bl -tag -width restart -offset indent 256.It Sy start | 253are automatically supported if it uses the 254.Fn run_rc_command 255function: 256.Bl -tag -width ".Cm restart" -offset indent 257.It Cm start |
257Start the service. 258This should check that the service is to be started as specified by 259.Xr rc.conf 5 . 260Also checks if the service is already running and refuses to start if 261it is. 262This latter check is not performed by standard 263.Fx 264scripts if the system is starting directly to multi-user mode, to 265speed up the boot process. 266If | 258Start the service. 259This should check that the service is to be started as specified by 260.Xr rc.conf 5 . 261Also checks if the service is already running and refuses to start if 262it is. 263This latter check is not performed by standard 264.Fx 265scripts if the system is starting directly to multi-user mode, to 266speed up the boot process. 267If |
267.Sq forcestart | 268.Cm forcestart |
268is given, ignore the 269.Xr rc.conf 5 270check and start anyway. | 269is given, ignore the 270.Xr rc.conf 5 271check and start anyway. |
271.It Sy stop | 272.It Cm stop |
272If the service is to be started as specified by 273.Xr rc.conf 5 , 274stop the service. | 273If the service is to be started as specified by 274.Xr rc.conf 5 , 275stop the service. |
275This should check that the service is running and complain if it's not. | 276This should check that the service is running and complain if it is not. |
276If | 277If |
277.Sq forcestop | 278.Cm forcestop |
278is given, ignore the 279.Xr rc.conf 5 280check and attempt to stop. | 279is given, ignore the 280.Xr rc.conf 5 281check and attempt to stop. |
281.It Sy restart | 282.It Cm restart |
282Perform a | 283Perform a |
283.Sy stop | 284.Cm stop |
284then a | 285then a |
285.Sy start . 286.It Sy status | 286.Cm start . 287.It Cm status |
287If the script starts a process (rather than performing a one-off 288operation), show the status of the process. | 288If the script starts a process (rather than performing a one-off 289operation), show the status of the process. |
289Otherwise it's not necessary to support this argument. | 290Otherwise it is not necessary to support this argument. |
290Defaults to displaying the process ID of the program (if running). | 291Defaults to displaying the process ID of the program (if running). |
291.It Sy poll | 292.It Cm poll |
292If the script starts a process (rather than performing a one-off 293operation), wait for the command to exit. | 293If the script starts a process (rather than performing a one-off 294operation), wait for the command to exit. |
294Otherwise it's not necessary to support this argument. 295.It Sy rcvar | 295Otherwise it is not necessary to support this argument. 296.It Cm rcvar |
296Display which 297.Xr rc.conf 5 298variables are used to control the startup of the service (if any). 299.El 300.Pp 301If a script must implement additional commands it can list them in 302the | 297Display which 298.Xr rc.conf 5 299variables are used to control the startup of the service (if any). 300.El 301.Pp 302If a script must implement additional commands it can list them in 303the |
303.Sq extra_commands 304variable and define their actions in a variable constructed from | 304.Va extra_commands 305variable, and define their actions in a variable constructed from |
305the command name (see the 306.Sx EXAMPLES 307section). 308.Pp 309The following key points apply to old-style scripts in | 306the command name (see the 307.Sx EXAMPLES 308section). 309.Pp 310The following key points apply to old-style scripts in |
310.Nm /usr/local/etc/rc.d : | 311.Pa /usr/local/etc/rc.d/ : |
311.Pp | 312.Pp |
312.Bl -bullet -compact | 313.Bl -bullet |
313.It 314Scripts are only executed if their 315.Xr basename 1 316matches the shell globbing pattern 317.Pa *.sh , 318and they are executable. 319Any other files or directories present within the directory are silently 320ignored. 321.It 322When a script is executed at boot time, it is passed the string | 314.It 315Scripts are only executed if their 316.Xr basename 1 317matches the shell globbing pattern 318.Pa *.sh , 319and they are executable. 320Any other files or directories present within the directory are silently 321ignored. 322.It 323When a script is executed at boot time, it is passed the string |
323.Dq start | 324.Dq Li start |
324as its first and only argument. 325At shutdown time, it is passed the string | 325as its first and only argument. 326At shutdown time, it is passed the string |
326.Dq stop | 327.Dq Li stop |
327as its first and only argument. 328All | 328as its first and only argument. 329All |
329.Nm rc.d | 330.Nm rc.d/ |
330scripts are expected to handle these arguments appropriately. 331If no action needs to be taken at a given time | 331scripts are expected to handle these arguments appropriately. 332If no action needs to be taken at a given time |
332(either boot time or shutdown time) | 333(either boot time or shutdown time), |
333the script should exit successfully and without producing an error message. 334.It 335The scripts within each directory are executed in lexicographical order. 336If a specific order is required, 337numbers may be used as a prefix to the existing filenames, 338so for example 339.Pa 100.foo 340would be executed before 341.Pa 200.bar ; 342without the numeric prefixes the opposite would be true. 343.It 344The output from each script is traditionally a space character, 345followed by the name of the software package being started or shut down, 346.Em without 347a trailing newline character (see the 348.Sx EXAMPLES 349section). 350.El | 334the script should exit successfully and without producing an error message. 335.It 336The scripts within each directory are executed in lexicographical order. 337If a specific order is required, 338numbers may be used as a prefix to the existing filenames, 339so for example 340.Pa 100.foo 341would be executed before 342.Pa 200.bar ; 343without the numeric prefixes the opposite would be true. 344.It 345The output from each script is traditionally a space character, 346followed by the name of the software package being started or shut down, 347.Em without 348a trailing newline character (see the 349.Sx EXAMPLES 350section). 351.El |
351.Sh Scripts of Interest | 352.Sh SCRIPTS OF INTEREST |
352When an automatic reboot is in progress, 353.Nm 354is invoked with the argument | 353When an automatic reboot is in progress, 354.Nm 355is invoked with the argument |
355.Em autoboot . | 356.Cm autoboot . |
356One of the scripts run from | 357One of the scripts run from |
357.Nm /etc/rc.d | 358.Pa /etc/rc.d/ |
358is 359.Pa /etc/rc.d/fsck . 360This script runs 361.Xr fsck 8 362with option 363.Fl p 364and 365.Fl F | 359is 360.Pa /etc/rc.d/fsck . 361This script runs 362.Xr fsck 8 363with option 364.Fl p 365and 366.Fl F |
366to ``preen'' all the disks of minor inconsistencies resulting 367from the last system shutdown. If this fails, then checks/repairs of serious inconsistencies 368caused by hardware or software failure will be performed in the background at the end 369of the booting process. If 370.Em autoboot 371is not set, when going from single-user to multi-user mode for example, the script 372does not do anything. | 367to 368.Dq preen 369all the disks of minor inconsistencies resulting 370from the last system shutdown. 371If this fails, then checks/repairs of serious inconsistencies 372caused by hardware or software failure will be performed 373in the background at the end of the booting process. 374If 375.Cm autoboot 376is not set, when going from single-user to multi-user mode for example, 377the script does not do anything. |
373.Pp 374The 375.Nm rc.early 376script is run very early in the startup process, immediately before the | 378.Pp 379The 380.Nm rc.early 381script is run very early in the startup process, immediately before the |
377filesystem check. The | 382filesystem check. 383The |
378.Nm rc.early | 384.Nm rc.early |
379script is deprecated. Any commands in this | 385script is deprecated. 386Any commands in this |
380file should be separated out into | 387file should be separated out into |
381.Nm rc.d | 388.Nm rc.d/ |
382style scripts and integrated into the | 389style scripts and integrated into the |
383.Nm rc | 390.Nm |
384system. 385.Pp 386The | 391system. 392.Pp 393The |
387.Nm /etc/rc.d/local | 394.Pa /etc/rc.d/local |
388script can execute scripts from multiple | 395script can execute scripts from multiple |
389.Nm rc.d | 396.Nm rc.d/ |
390directories. 391The default locations are | 397directories. 398The default locations are |
392.Pa /usr/local/etc/rc.d | 399.Pa /usr/local/etc/rc.d/ |
393and | 400and |
394.Pa /usr/X11R6/etc/rc.d , | 401.Pa /usr/X11R6/etc/rc.d/ , |
395but these may be overridden with the 396.Va local_startup 397.Xr rc.conf 5 398variable. 399.Pp 400The | 402but these may be overridden with the 403.Va local_startup 404.Xr rc.conf 5 405variable. 406.Pp 407The |
401.Nm /etc/rc.d/serial | 408.Pa /etc/rc.d/serial |
402script is used to set any special configurations for serial devices. 403.Pp 404The | 409script is used to set any special configurations for serial devices. 410.Pp 411The |
405.Nm /etc/rc.d/pccard | 412.Pa /etc/rc.d/pccard |
406script is used to enable PC-cards. 407.Pp 408The | 413script is used to enable PC-cards. 414.Pp 415The |
409.Nm /etc/rc.d/network* | 416.Pa /etc/rc.d/network* |
410scripts are used to start the network. | 417scripts are used to start the network. |
411The network is started in three passes. | 418The network is started in several passes. |
412The first pass, | 419The first pass, |
413.Nm /etc/rc.d/network1 , | 420.Pa /etc/rc.d/network1 , |
414sets the hostname and domainname and configures the network | 421sets the hostname and domainname and configures the network |
415interfaces. The 416.Nm /etc/rc.d/network2 417script starts routing and sets routing options. The 418.Nm /etc/rc.d/network3 419script sets additional networking options. Lastly, the 420.Nm /etc/rc.d/network_ipv6 | 422interfaces. 423The 424.Pa /etc/rc.d/network2 425script starts routing and sets routing options. 426The 427.Pa /etc/rc.d/network3 428script sets additional networking options. 429Finally, the 430.Pa /etc/rc.d/network_ipv6 |
421script configures IPv6 interfaces and options. 422.Pp 423The 424.Nm rc.firewall 425script is used to configure rules for the kernel based firewall 426service. 427It has several possible options: 428.Pp | 431script configures IPv6 interfaces and options. 432.Pp 433The 434.Nm rc.firewall 435script is used to configure rules for the kernel based firewall 436service. 437It has several possible options: 438.Pp |
429.Bl -tag -width "fBfilename" -compact -offset indent 430.It open 431will allow anyone in. 432.It client 433will try to protect just this machine. 434.It simple 435will try to protect a whole network. 436.It closed 437totally disables IP services except via lo0 interface. 438.It UNKNOWN 439disables the loading of firewall rules. 440.It filename | 439.Bl -tag -width ".Ar filename" -compact -offset indent 440.It Cm open 441will allow anyone in 442.It Cm client 443will try to protect just this machine 444.It Cm simple 445will try to protect a whole network 446.It Cm closed 447totally disables IP services except via 448.Pa lo0 449interface 450.It Cm UNKNOWN 451disables the loading of firewall rules 452.It Ar filename |
441will load the rules in the given filename (full path required). 442.El 443.Pp 444The | 453will load the rules in the given filename (full path required). 454.El 455.Pp 456The |
445.Nm /etc/rc.d/atm* | 457.Pa /etc/rc.d/atm* |
446scripts are used to configure ATM network interfaces. 447The interfaces are configured in three passes. 448The first pass performs the initial interface configuration. 449The second pass completes the interface configuration and defines PVCs and 450permanent ATMARP entries. 451The third pass starts any ATM daemons. 452.Pp 453Most daemons, including network related daemons, have their own script in | 458scripts are used to configure ATM network interfaces. 459The interfaces are configured in three passes. 460The first pass performs the initial interface configuration. 461The second pass completes the interface configuration and defines PVCs and 462permanent ATMARP entries. 463The third pass starts any ATM daemons. 464.Pp 465Most daemons, including network related daemons, have their own script in |
454.Nm /etc/rc.d , | 466.Pa /etc/rc.d/ , |
455which can be used to start, stop, and check the status of the service. 456.Pp 457Any architecture specific scripts, such as 458.Pa /etc/rc.d/apm 459for example, specifically check that they are on that architecture 460before starting the daemon. 461.Pp 462Following tradition, all startup files reside in 463.Pa /etc . 464.Sh EXAMPLES 465The following is a minimal | 467which can be used to start, stop, and check the status of the service. 468.Pp 469Any architecture specific scripts, such as 470.Pa /etc/rc.d/apm 471for example, specifically check that they are on that architecture 472before starting the daemon. 473.Pp 474Following tradition, all startup files reside in 475.Pa /etc . 476.Sh EXAMPLES 477The following is a minimal |
466.Nm /etc/rc.d 467style script. Most scripts require little more than the following. | 478.Nm rc.d/ 479style script. 480Most scripts require little more than the following. |
468.Bd -literal -offset indent 469#!/bin/sh 470# 471 472# PROVIDE: foo 473# REQUIRE: bar_service_required_to_precede_foo 474# BEFORE: baz_service_requiring_foo_to_precede_it 475# KEYWORD: FreeBSD 476 | 481.Bd -literal -offset indent 482#!/bin/sh 483# 484 485# PROVIDE: foo 486# REQUIRE: bar_service_required_to_precede_foo 487# BEFORE: baz_service_requiring_foo_to_precede_it 488# KEYWORD: FreeBSD 489 |
477. /etc/rc.subr | 490\&. /etc/rc.subr |
478 479name="foo" 480rcvar=`set_rcvar` 481command="/usr/local/bin/foo" 482 483load_rc_config $name 484run_rc_command "$1" 485.Ed 486.Pp | 491 492name="foo" 493rcvar=`set_rcvar` 494command="/usr/local/bin/foo" 495 496load_rc_config $name 497run_rc_command "$1" 498.Ed 499.Pp |
487Certain scripts may want to provide enhanced functionality. The 488user may access this functionality through additional commands. The 489script may list and define as many commands at it needs. | 500Certain scripts may want to provide enhanced functionality. 501The user may access this functionality through additional commands. 502The script may list and define as many commands at it needs. |
490.Bd -literal -offset indent 491#!/bin/sh 492# 493 494# PROVIDE: foo 495# REQUIRE: bar_service_required_to_precede_foo 496# BEFORE: baz_service_requiring_foo_to_precede_it 497# KEYWORD: FreeBSD 498 | 503.Bd -literal -offset indent 504#!/bin/sh 505# 506 507# PROVIDE: foo 508# REQUIRE: bar_service_required_to_precede_foo 509# BEFORE: baz_service_requiring_foo_to_precede_it 510# KEYWORD: FreeBSD 511 |
499. /etc/rc.subr | 512\&. /etc/rc.subr |
500 501name="foo" 502rcvar=`set_rcvar` 503command="/usr/local/bin/foo" 504extra_commands="nop hello" 505hello_cmd="echo Hello World." 506nop_cmd="do_nop" 507 508do_nop() 509{ 510 echo "I do nothing." 511} 512 513load_rc_config $name 514run_rc_command "$1" 515.Ed 516.Pp 517The following is a simple, hypothetical example of an old-style | 513 514name="foo" 515rcvar=`set_rcvar` 516command="/usr/local/bin/foo" 517extra_commands="nop hello" 518hello_cmd="echo Hello World." 519nop_cmd="do_nop" 520 521do_nop() 522{ 523 echo "I do nothing." 524} 525 526load_rc_config $name 527run_rc_command "$1" 528.Ed 529.Pp 530The following is a simple, hypothetical example of an old-style |
518.Nm /usr/local/etc/rc.d | 531.Pa /usr/local/etc/rc.d/ |
519script, 520which would start a daemon at boot time, 521and kill it at shutdown time. 522.Bd -literal -offset indent 523#!/bin/sh - 524# 525# initialization/shutdown script for foobar package 526 --- 10 unchanged lines hidden (view full) --- 537esac 538.Ed 539.Pp 540As all processes are killed by 541.Xr init 8 542at shutdown, the explicit 543.Xr kill 1 544is unnecessary, but is often included. | 532script, 533which would start a daemon at boot time, 534and kill it at shutdown time. 535.Bd -literal -offset indent 536#!/bin/sh - 537# 538# initialization/shutdown script for foobar package 539 --- 10 unchanged lines hidden (view full) --- 550esac 551.Ed 552.Pp 553As all processes are killed by 554.Xr init 8 555at shutdown, the explicit 556.Xr kill 1 557is unnecessary, but is often included. |
558.Sh FILES 559.Bl -tag -compact 560.It Pa /etc/rc 561.It Pa /etc/rc.conf 562.It Pa /etc/rc.conf.local 563.It Pa /etc/rc.d/ 564.It Pa /etc/rc.firewall 565.It Pa /etc/rc.local 566.It Pa /etc/rc.shutdown 567.It Pa /etc/rc.subr 568.El |
|
545.Sh SEE ALSO 546.Xr kill 1 , 547.Xr rc.conf 5 , 548.Xr init 8 , 549.Xr rc.subr 8 , 550.Xr rcorder 8 , 551.Xr reboot 8 , 552.Xr savecore 8 553.Sh HISTORY 554The 555.Nm 556utility appeared in 557.Bx 4.0 . | 569.Sh SEE ALSO 570.Xr kill 1 , 571.Xr rc.conf 5 , 572.Xr init 8 , 573.Xr rc.subr 8 , 574.Xr rcorder 8 , 575.Xr reboot 8 , 576.Xr savecore 8 577.Sh HISTORY 578The 579.Nm 580utility appeared in 581.Bx 4.0 . |