/[baselayout]/trunk/sbin/rc-help.sh
Gentoo

Contents of /trunk/sbin/rc-help.sh

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.20