From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1GLFAB-0002QU-2F for garchives@archives.gentoo.org; Thu, 07 Sep 2006 08:23:07 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.8/8.13.6) with SMTP id k878N4ds025425; Thu, 7 Sep 2006 08:23:04 GMT Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by robin.gentoo.org (8.13.8/8.13.6) with ESMTP id k878N3m1024557 for ; Thu, 7 Sep 2006 08:23:03 GMT Received: from lark (lark.gentoo.osuosl.org [140.211.166.177]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with SMTP id 0C86B64465 for ; Thu, 7 Sep 2006 08:23:03 +0000 (UTC) Received: by lark (sSMTP sendmail emulation); Thu, 7 Sep 2006 08:23:02 +0000 From: "Josh Saddler" Date: Thu, 7 Sep 2006 08:23:02 +0000 To: gentoo-doc-cvs@lists.gentoo.org Subject: [gentoo-doc-cvs] cvs commit: handbook-x86.xml hb-working-rcscripts.xml Message-Id: <20060907082303.0C86B64465@smtp.gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-doc-cvs@gentoo.org Reply-to: docs-team@lists.gentoo.org X-Archives-Salt: bf23b578-f7f8-4daf-8f6f-595105c512fc X-Archives-Hash: 97f442c0d7b11e91004b56bd556da60a nightmorph 06/09/07 08:23:02 Modified: handbook-x86.xml hb-working-rcscripts.xml Log: updated stop-start-daemon documentation for bug 122786 Revision Changes Path 1.153 xml/htdocs/doc/en/handbook/handbook-x86.xml file : http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/doc/en/handbook/handbook-x86.xml?rev=1.153&view=markup plain: http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/doc/en/handbook/handbook-x86.xml?rev=1.153&content-type=text/plain diff : http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/doc/en/handbook/handbook-x86.xml?r1=1.152&r2=1.153 Index: handbook-x86.xml =================================================================== RCS file: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/handbook-x86.xml,v retrieving revision 1.152 retrieving revision 1.153 diff -u -r1.152 -r1.153 --- handbook-x86.xml 30 Aug 2006 22:52:28 -0000 1.152 +++ handbook-x86.xml 7 Sep 2006 08:23:02 -0000 1.153 @@ -1,7 +1,7 @@ - + Gentoo Linux x86 Handbook @@ -111,6 +111,9 @@ Xavier Neys + + Joshua Saddler + Grant Goodyear @@ -137,8 +140,8 @@ -7.0 -2006-08-30 +7.1 +2006-09-07 Installing Gentoo 1.26 xml/htdocs/doc/en/handbook/hb-working-rcscripts.xml file : http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/doc/en/handbook/hb-working-rcscripts.xml?rev=1.26&view=markup plain: http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/doc/en/handbook/hb-working-rcscripts.xml?rev=1.26&content-type=text/plain diff : http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/doc/en/handbook/hb-working-rcscripts.xml?r1=1.25&r2=1.26 Index: hb-working-rcscripts.xml =================================================================== RCS file: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-working-rcscripts.xml,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- hb-working-rcscripts.xml 14 Mar 2006 19:29:29 -0000 1.25 +++ hb-working-rcscripts.xml 7 Sep 2006 08:23:02 -0000 1.26 @@ -4,12 +4,12 @@ - + -1.21 -2005-05-29 +1.22 +2006-09-07
Runlevels @@ -535,6 +535,19 @@ } +

+If your service must write to local disks, it should need localmount. If +it places anything in /var/run such as a pidfile, then should +start after bootmisc: +

+ +
+depend() {
+  need localmount
+  after bootmisc
+}
+
+ @@ -551,21 +564,33 @@
 start() {
   ebegin "Starting my_service"
-  start-stop-daemon --start --quiet --exec /path/to/my_service
+  start-stop-daemon --start --exec /path/to/my_service \
+    --pidfile /path/to/my_pidfile
   eend $?
 }
 

-If you need more examples of the start() function, please read the source -code of the available init scripts in your /etc/init.d directory. -As for start-stop-daemon, there is an excellent man page available if you -need more information: +Both --exec and --pidfile should be used in start and stop +functions. If the service does not create a pidfile, then use +--make-pidfile if possible, though you should test this to be sure. +Otherwise, don't use pidfiles. You can also add --quiet to the +start-stop-daemon options, but this is not recommended unless the +service is extremely verbose. Using --quiet may hinder debugging if the +service fails to start.

-
-# man start-stop-daemon
-
+ +Make sure that --exec actually calls a service and not just a shell +script that launches services and exits -- that's what the init script is +supposed to do. + + +

+If you need more examples of the start() function, please read the +source code of the available init scripts in your /etc/init.d +directory. +

Other functions you can define are: stop() and restart(). You are @@ -574,6 +599,46 @@

+Although you do not have to create a stop() function, here is an +example: +

+ +
+stop() {
+  ebegin "Stopping my_service"
+  start-stop-daemon --stop --exec /path/to/my_service \
+    --pidfile /path/to/my_pidfile
+  eend $?
+}
+
+ +

+If your service runs some other script (for example, bash, python, or perl), +and this script later changes names (for example, foo.py to foo), +then you will need to add --name to start-stop-daemon. You must +specify the name that your script will be changed to. In this example, a +service starts foo.py, which changes names to foo: +

+ +
+start() {
+  ebegin "Starting my_script"
+  start-stop-daemon --start --exec /path/to/my_script \
+    --pidfile /path/to/my_pidfile --name foo
+  eend $?
+}
+
+ +

+start-stop-daemon has an excellent man page available if you need more +information: +

+ +
+$ man start-stop-daemon
+
+ +

Gentoo's init script syntax is based on the Bourne Again Shell (bash) so you are free to use bash-compatible constructs inside your init script.

-- gentoo-doc-cvs@gentoo.org mailing list