Gentoo Archives: gentoo-doc-cvs

From: Josh Saddler <nightmorph@×××××××××××.org>
To: gentoo-doc-cvs@l.g.o
Subject: [gentoo-doc-cvs] cvs commit: handbook-x86.xml hb-working-rcscripts.xml
Date: Thu, 07 Sep 2006 08:23:07
Message-Id: 20060907082303.0C86B64465@smtp.gentoo.org
1 nightmorph 06/09/07 08:23:02
2
3 Modified: handbook-x86.xml hb-working-rcscripts.xml
4 Log:
5 updated stop-start-daemon documentation for bug 122786
6
7 Revision Changes Path
8 1.153 xml/htdocs/doc/en/handbook/handbook-x86.xml
9
10 file : http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/doc/en/handbook/handbook-x86.xml?rev=1.153&view=markup
11 plain: http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/doc/en/handbook/handbook-x86.xml?rev=1.153&content-type=text/plain
12 diff : http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/doc/en/handbook/handbook-x86.xml?r1=1.152&r2=1.153
13
14 Index: handbook-x86.xml
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/handbook-x86.xml,v
17 retrieving revision 1.152
18 retrieving revision 1.153
19 diff -u -r1.152 -r1.153
20 --- handbook-x86.xml 30 Aug 2006 22:52:28 -0000 1.152
21 +++ handbook-x86.xml 7 Sep 2006 08:23:02 -0000 1.153
22 @@ -1,7 +1,7 @@
23 <?xml version='1.0' encoding='UTF-8'?>
24 <!DOCTYPE book SYSTEM "/dtd/book.dtd">
25
26 -<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/handbook-x86.xml,v 1.152 2006/08/30 22:52:28 nightmorph Exp $ -->
27 +<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/handbook-x86.xml,v 1.153 2006/09/07 08:23:02 nightmorph Exp $ -->
28
29 <book link="/doc/en/handbook/handbook-x86.xml">
30 <title>Gentoo Linux x86 Handbook</title>
31 @@ -111,6 +111,9 @@
32 <author title="Editor">
33 <mail link="neysx@g.o">Xavier Neys</mail>
34 </author>
35 +<author title="Editor">
36 + <mail link="nightmorph@g.o">Joshua Saddler</mail>
37 +</author>
38 <author title="Reviewer">
39 <mail link="g2boojum@g.o">Grant Goodyear</mail>
40 </author>
41 @@ -137,8 +140,8 @@
42 <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
43 <license/>
44
45 -<version>7.0</version>
46 -<date>2006-08-30</date>
47 +<version>7.1</version>
48 +<date>2006-09-07</date>
49
50 <part>
51 <title>Installing Gentoo</title>
52
53
54
55 1.26 xml/htdocs/doc/en/handbook/hb-working-rcscripts.xml
56
57 file : http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/doc/en/handbook/hb-working-rcscripts.xml?rev=1.26&view=markup
58 plain: http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/doc/en/handbook/hb-working-rcscripts.xml?rev=1.26&content-type=text/plain
59 diff : http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/doc/en/handbook/hb-working-rcscripts.xml?r1=1.25&r2=1.26
60
61 Index: hb-working-rcscripts.xml
62 ===================================================================
63 RCS file: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-working-rcscripts.xml,v
64 retrieving revision 1.25
65 retrieving revision 1.26
66 diff -u -r1.25 -r1.26
67 --- hb-working-rcscripts.xml 14 Mar 2006 19:29:29 -0000 1.25
68 +++ hb-working-rcscripts.xml 7 Sep 2006 08:23:02 -0000 1.26
69 @@ -4,12 +4,12 @@
70 <!-- The content of this document is licensed under the CC-BY-SA license -->
71 <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
72
73 -<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-working-rcscripts.xml,v 1.25 2006/03/14 19:29:29 neysx Exp $ -->
74 +<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-working-rcscripts.xml,v 1.26 2006/09/07 08:23:02 nightmorph Exp $ -->
75
76 <sections>
77
78 -<version>1.21</version>
79 -<date>2005-05-29</date>
80 +<version>1.22</version>
81 +<date>2006-09-07</date>
82
83 <section>
84 <title>Runlevels</title>
85 @@ -535,6 +535,19 @@
86 }
87 </pre>
88
89 +<p>
90 +If your service must write to local disks, it should need <c>localmount</c>. If
91 +it places anything in <path>/var/run</path> such as a pidfile, then should
92 +start after <c>bootmisc</c>:
93 +</p>
94 +
95 +<pre caption="Example depend() function">
96 +depend() {
97 + need localmount
98 + after bootmisc
99 +}
100 +</pre>
101 +
102 </body>
103 </subsection>
104 <subsection>
105 @@ -551,21 +564,33 @@
106 <pre caption="Example start() function">
107 start() {
108 ebegin "Starting my_service"
109 - start-stop-daemon --start --quiet --exec /path/to/my_service
110 + start-stop-daemon --start --exec /path/to/my_service \
111 + --pidfile /path/to/my_pidfile
112 eend $?
113 }
114 </pre>
115
116 <p>
117 -If you need more examples of the <c>start()</c> function, please read the source
118 -code of the available init scripts in your <path>/etc/init.d</path> directory.
119 -As for <c>start-stop-daemon</c>, there is an excellent man page available if you
120 -need more information:
121 +Both <c>--exec</c> and <c>--pidfile</c> should be used in start and stop
122 +functions. If the service does not create a pidfile, then use
123 +<c>--make-pidfile</c> if possible, though you should test this to be sure.
124 +Otherwise, don't use pidfiles. You can also add <c>--quiet</c> to the
125 +<c>start-stop-daemon</c> options, but this is not recommended unless the
126 +service is extremely verbose. Using <c>--quiet</c> may hinder debugging if the
127 +service fails to start.
128 </p>
129
130 -<pre caption="Getting the man page for start-stop-daemon">
131 -# <i>man start-stop-daemon</i>
132 -</pre>
133 +<note>
134 +Make sure that <c>--exec</c> actually calls a service and not just a shell
135 +script that launches services and exits -- that's what the init script is
136 +supposed to do.
137 +</note>
138 +
139 +<p>
140 +If you need more examples of the <c>start()</c> function, please read the
141 +source code of the available init scripts in your <path>/etc/init.d</path>
142 +directory.
143 +</p>
144
145 <p>
146 Other functions you can define are: <c>stop()</c> and <c>restart()</c>. You are
147 @@ -574,6 +599,46 @@
148 </p>
149
150 <p>
151 +Although you do not <e>have</e> to create a <c>stop()</c> function, here is an
152 +example:
153 +</p>
154 +
155 +<pre caption="Example stop() function">
156 +stop() {
157 + ebegin "Stopping my_service"
158 + start-stop-daemon --stop --exec /path/to/my_service \
159 + --pidfile /path/to/my_pidfile
160 + eend $?
161 +}
162 +</pre>
163 +
164 +<p>
165 +If your service runs some other script (for example, bash, python, or perl),
166 +and this script later changes names (for example, <c>foo.py</c> to <c>foo</c>),
167 +then you will need to add <c>--name</c> to <c>start-stop-daemon</c>. You must
168 +specify the name that your script will be changed to. In this example, a
169 +service starts <c>foo.py</c>, which changes names to <c>foo</c>:
170 +</p>
171 +
172 +<pre caption="A service that starts the foo script">
173 +start() {
174 + ebegin "Starting my_script"
175 + start-stop-daemon --start --exec /path/to/my_script \
176 + --pidfile /path/to/my_pidfile --name foo
177 + eend $?
178 +}
179 +</pre>
180 +
181 +<p>
182 +<c>start-stop-daemon</c> has an excellent man page available if you need more
183 +information:
184 +</p>
185 +
186 +<pre caption="Getting the man page for start-stop-daemon">
187 +$ <i>man start-stop-daemon</i>
188 +</pre>
189 +
190 +<p>
191 Gentoo's init script syntax is based on the Bourne Again Shell (bash) so you are
192 free to use bash-compatible constructs inside your init script.
193 </p>
194
195
196
197 --
198 gentoo-doc-cvs@g.o mailing list