|
Lines 71-77
Link Here
|
| 71 |
The |
71 |
The |
| 72 |
.Nm rc.d |
72 |
.Nm rc.d |
| 73 |
directories contain scripts which will be automatically |
73 |
directories contain scripts which will be automatically |
| 74 |
executed at boot time. |
74 |
executed at boot and shutdown time. |
| 75 |
The specified directories are processed immediately after |
75 |
The specified directories are processed immediately after |
| 76 |
.Nm rc.local |
76 |
.Nm rc.local |
| 77 |
is executed. |
77 |
is executed. |
|
Lines 88-100
Link Here
|
| 88 |
Any other files or directories present within the directory are silently |
88 |
Any other files or directories present within the directory are silently |
| 89 |
ignored. |
89 |
ignored. |
| 90 |
.It |
90 |
.It |
| 91 |
When a script is executed, it is passed the string |
91 |
When a script is executed at boot time, it is passed the string |
| 92 |
.Dq start |
92 |
.Dq start |
| 93 |
as its first and only argument. |
93 |
as its first and only argument. |
| 94 |
All |
94 |
All |
| 95 |
.Nm rc.d |
95 |
.Nm rc.d |
| 96 |
scripts expected to handle this argument appropriately. |
96 |
scripts expected to handle this argument appropriately. |
| 97 |
.It |
97 |
.It |
|
|
98 |
When a script is executed at shutdown time, it is passed the string |
| 99 |
.Dq stop |
| 100 |
as its first and only argument. |
| 101 |
All |
| 102 |
.Nm rc.d |
| 103 |
scripts expected to handle this argument appropriately. |
| 104 |
.It |
| 98 |
The scripts within each directory are executed in lexicographical order. |
105 |
The scripts within each directory are executed in lexicographical order. |
| 99 |
If a specific order is required, |
106 |
If a specific order is required, |
| 100 |
numbers may be used as a prefix to the existing filenames, |
107 |
numbers may be used as a prefix to the existing filenames, |
|
Lines 222-233
Link Here
|
| 222 |
# |
229 |
# |
| 223 |
# initialization/shutdown script for foobar package |
230 |
# initialization/shutdown script for foobar package |
| 224 |
|
231 |
|
|
|
232 |
PIDFILE=/var/run/foo.pid |
| 225 |
case "$1" in |
233 |
case "$1" in |
| 226 |
start) |
234 |
start) |
| 227 |
/usr/local/sbin/foo -d && echo -n ' foo' |
235 |
/usr/local/sbin/foo -d -f $PIDFILE && echo -n ' foo' |
|
|
236 |
;; |
| 237 |
stop) |
| 238 |
kill `cat $PIDFILE` && echo -n ' foo' |
| 228 |
;; |
239 |
;; |
| 229 |
*) |
240 |
*) |
| 230 |
echo "unknown option: $1 - should be 'start'" >&2 |
241 |
echo "usage: `basename $0` {start|stop}" >&2 |
|
|
242 |
exit 1 |
| 231 |
;; |
243 |
;; |
| 232 |
esac |
244 |
esac |
| 233 |
.Ed |
245 |
.Ed |