/[baselayout]/trunk/init.d/rc-help.sh
Gentoo

Contents of /trunk/init.d/rc-help.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 127 - (show annotations) (download) (as text)
Sun Feb 17 02:24:47 2002 UTC (18 years, 8 months ago) by azarah
File MIME type: text/x-sh
File size: 6435 byte(s)
misc fixes

1 #!/bin/bash
2 # Copyright 1999-2002 Gentoo Technologies, Inc.
3 # Distributed under the terms of the GNU General Public License, v2 or later
4 # $Header$
5
6
7 source /etc/init.d/functions.sh
8
9 BLUE="\033[34;01m"
10 GREEN="\033[32;01m"
11 OFF="\033[0m"
12 CYAN="\033[36;01m"
13
14 myscript=${1}
15 if [ -L $1 ]
16 then
17 myservice=`readlink ${1}`
18 else
19 myservice=${1}
20 fi
21
22 myservice=${myservice##*/}
23
24 echo
25 echo -e "${GREEN}Gentoo Linux RC-Scripts; ${BLUE}http://www.gentoo.org/${OFF}"
26 echo -e " Copyright 2002 Gentoo Technologies, Inc.; Distributed under the GPL"
27 echo
28 echo -e "Usage: ${CYAN}${myservice}${OFF} [ ${GREEN}options${OFF} ]"
29 echo
30 echo -e "${CYAN}Options:${OFF}"
31 echo -e " ${GREEN}start${OFF}"
32 cat <<EOHELP
33 Start service, as well as the services it depends on (if not already
34 started).
35
36 EOHELP
37 echo -e " ${GREEN}stop${OFF}"
38 cat <<EOHELP
39 Stop service, as well as the services that depend on it (if not already
40 stopped).
41
42 EOHELP
43 echo -e " ${GREEN}restart${OFF}"
44 cat <<EOHELP
45 Restart service, as well as the services that depend on it.
46
47 Note to developers: If this function is replaced with a custom one,
48 'svc_start' and 'svc_stop' should be used instead of 'start' and
49 'stop' to restart the service. This is so that the dependancies
50 can be handled correctly. Refer to the portmap rc-script for an
51 example.
52
53 EOHELP
54 echo -e " ${GREEN}pause${OFF}"
55 cat <<EOHELP
56 Same as 'stop', but the services that depends on it, will not be
57 stopped. This is usefull for stopping a network interface without
58 stopping all the network services that depend on 'net'.
59
60 EOHELP
61 echo -e " ${GREEN}zap${OFF}"
62 cat <<EOHELP
63 Reset a service that is currently stopped, but still marked as started,
64 to the stopped state. Basically for killing zombie services.
65
66 EOHELP
67 echo -e " ${GREEN}ineed|iuse${OFF}"
68 cat <<EOHELP
69 List the services this one depends on. Consult the section about
70 dependancies for more info on the different types of dependancies.
71
72 EOHELP
73 echo -e " ${GREEN}needsme|usesme${OFF}"
74 cat <<EOHELP
75 List the services that depends on this one. Consult the section about
76 dependancies for more info on the different types of dependancies.
77
78 EOHELP
79 echo -e " ${GREEN}broken${OFF}"
80 cat <<EOHELP
81 List the missing or broken dependancies of type 'need' this service
82 depends on.
83
84 EOHELP
85 echo -e "${CYAN}Dependancies:${OFF}"
86 cat <<EOHELP
87 This is the heart of the Gentoo RC-Scritps, as it determines the order
88 in which services gets started, and also to some extend what services
89 get started in the first place.
90
91 The following example demonstrates how to use dependancies in
92 rc-scripts:
93
94 depend() {
95 need foo bar
96 use ray
97 }
98
99 Here we have foo and bar as dependancies of type 'need', and ray of
100 type 'use'. You can have as many dependancies of each type as needed, as
101 long as there is only one entry for each type, listing all its dependancies
102 on one line only.
103
104 EOHELP
105 echo -e " ${GREEN}need${OFF}"
106 cat <<EOHELP
107 This is all the services needed for this service to start. If any service
108 in the 'need' line is not started, it will be started even if it is not
109 in the current, or 'boot' runlevel, and then this service. If any services
110 in the 'need' line fails to start or is missing, this service will nerver
111 get started.
112
113 EOHELP
114 echo -e " ${GREEN}use${OFF}"
115 cat <<EOHELP
116 This can be seen as optional services this service depends on, but is not
117 critical for it to start. For any service in the 'use' line, it must
118 be added to the 'boot' or current runlevel to be considered a valid
119 'use' dependancy. It can also be used to determine startup order.
120
121 EOHELP
122 echo -e " ${GREEN}before${OFF}"
123 cat <<EOHELP
124 This, together with the 'after' dependancy type, can be used to control
125 startup order. In core, 'before' and 'after' do not denote dependancy,
126 but should be used for order changes that should only be honoured during
127 a change of runlevel. All services listed will get started *after* the
128 current service, in other words, this service will get started *before*
129 all listed services.
130
131 EOHELP
132 echo -e " ${GREEN}after${OFF}"
133 cat <<EOHELP
134 All services listed will be started *before* the current service. Have a
135 look at 'before' for more info.
136
137 EOHELP
138 echo -e " ${GREEN}provide${OFF}"
139 cat <<EOHELP
140 This is not really a dependancy type, but rather enable you to create
141 virtual services. This is usefull if there is more than one version of
142 a specific service type, like system loggers or crons for instance. Just
143 have each system logger provide 'logger', and make all services in need
144 of a system logger depend on 'logger'. This should make things much more
145 generic.
146
147 EOHELP
148 cat <<EOHELP
149 Note that the 'need', 'use', 'before' and 'after' dependany types can have '*'
150 as argument. Having:
151
152 depend() {
153 before *
154 }
155
156 will make the service be the first to start in the current runlevel, and:
157
158 depend() {
159 after *
160 }
161
162 will make the service the last to start.
163
164 You should however be carefull how you use this, as I really will not
165 recommend using it with the 'need' or 'use' dependancy type ... you have
166 been warned!
167
168 EOHELP
169 echo -e "${CYAN}'net' Dependancy and 'net.*' Services:${OFF}"
170 cat <<EOHELP
171 Example:
172
173 depend() {
174 need net
175 }
176
177 This is a special dependancy of type 'need'. It represents a state where
178 a network interface or interfaces besides lo is up and active. Any service
179 starting with 'net.' will be treated as a part of the 'net' dependancy,
180 if:
181
182 1. It is part of the 'boot' runlevel
183 2. It is part of the current runlevel
184
185 A few examples is the /etc/init.d/net.eth0 and /etc/init.d/net.lo services.
186
187 EOHELP
188 echo -e "${CYAN}Configuration files:${OFF}"
189 cat <<EOHELP
190 There are three files which will be sourced for possible configuration by
191 the rc-scripts. They are (sourced from top to bottom):
192
193 /etc/conf.d/basic
194 /etc/conf.d/${myservice}
195 /etc/rc.conf
196
197 EOHELP
198 echo -e "${CYAN}Management:${OFF}"
199 cat <<EOHELP
200 Services are added and removed via the 'rc-update' tool. Running it without
201 arguments should give sufficient help.
202
203 EOHELP

Properties

Name Value
svn:eol-style native
svn:executable *
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.20