public inbox for gentoo-doc-cvs@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sven Vermeulen (swift)" <swift@gentoo.org>
To: gentoo-doc-cvs@lists.gentoo.org
Subject: [gentoo-doc-cvs] gentoo commit in xml/htdocs/doc/en/handbook: hb-working-rcscripts.xml
Date: Fri, 12 Aug 2011 19:34:56 +0000 (UTC)	[thread overview]
Message-ID: <20110812193456.54FD02004C@flycatcher.gentoo.org> (raw)

swift       11/08/12 19:34:56

  Modified:             hb-working-rcscripts.xml
  Log:
  Fix #348724 (documentation part) - Document that restart functionality is not something users can define in the init scripts themselves

Revision  Changes    Path
1.33                 xml/htdocs/doc/en/handbook/hb-working-rcscripts.xml

file : http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/handbook/hb-working-rcscripts.xml?rev=1.33&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/handbook/hb-working-rcscripts.xml?rev=1.33&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/handbook/hb-working-rcscripts.xml?r1=1.32&r2=1.33

Index: hb-working-rcscripts.xml
===================================================================
RCS file: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-working-rcscripts.xml,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- hb-working-rcscripts.xml	2 Mar 2011 08:09:48 -0000	1.32
+++ hb-working-rcscripts.xml	12 Aug 2011 19:34:56 -0000	1.33
@@ -4,7 +4,7 @@
 <!-- The content of this document is licensed under the CC-BY-SA license -->
 <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
 
-<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-working-rcscripts.xml,v 1.32 2011/03/02 08:09:48 nightmorph Exp $ -->
+<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-working-rcscripts.xml,v 1.33 2011/08/12 19:34:56 swift Exp $ -->
 
 <sections>
 
@@ -14,8 +14,8 @@
 these aspects and explains how to deal with these scripts.
 </abstract>
 
-<version>2</version>
-<date>2011-03-02</date>
+<version>3</version>
+<date>2011-08-12</date>
 
 <section>
 <title>Runlevels</title>
@@ -440,10 +440,6 @@
 stop() {
   <comment>(Commands necessary to stop the service)</comment>
 }
-
-restart() {
-  <comment>(Commands necessary to restart the service)</comment>
-}
 </pre>
 
 <p>
@@ -574,6 +570,11 @@
 
 <pre caption="Example start() function">
 start() {
+  if [ "${RC_CMD}" = "restart" ];
+  then
+    <comment># Do something in case a restart requires more than stop, start</comment>
+  fi
+
   ebegin "Starting my_service"
   start-stop-daemon --start --exec /path/to/my_service \
     --pidfile /path/to/my_pidfile
@@ -591,6 +592,15 @@
 service fails to start.
 </p>
 
+<p>
+Another notable setting used in the above example is to check the contents of
+the <c>RC_CMD</c> variable. Unlike the previous init script system, the newer
+<c>openrc</c> system does not support script-specific restart functionality.
+Instead, the script needs to check the contents of the <c>RC_CMD</c> variable
+to see if a function (be it <c>start()</c> or <c>stop()</c>) is called as part
+of a restart or not.
+</p>
+
 <note>
 Make sure that <c>--exec</c> actually calls a service and not just a shell
 script that launches services and exits -- that's what the init script is
@@ -604,14 +614,13 @@
 </p>
 
 <p>
-Other functions you can define are: <c>stop()</c> and <c>restart()</c>. You are
-not obliged to define these functions! Our init system is intelligent enough to
-fill these functions by itself if you use <c>start-stop-daemon</c>.
+Another function you can define is <c>stop()</c>. You are not obliged to define
+this function though! Our init system is intelligent enough to fill in this
+function by itself if you use <c>start-stop-daemon</c>.
 </p>
 
 <p>
-Although you do not <e>have</e> to create a <c>stop()</c> function, here is an
-example:
+Here is an example of a <c>stop()</c> function:
 </p>
 
 <pre caption="Example stop() function">
@@ -681,6 +690,10 @@
 }
 </pre>
 
+<impo>
+The function <c>restart()</c> cannot be overridden in openrc!
+</impo>
+
 </body>
 </subsection>
 <subsection>






             reply	other threads:[~2011-08-12 19:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-12 19:34 Sven Vermeulen (swift) [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-08-01 19:41 [gentoo-doc-cvs] gentoo commit in xml/htdocs/doc/en/handbook: hb-working-rcscripts.xml Sven Vermeulen (swift)
2012-10-31 19:02 Sven Vermeulen (swift)
2011-09-17 12:45 Sven Vermeulen (swift)
2011-08-17  7:57 Sven Vermeulen (swift)
2011-03-02  8:09 Joshua Saddler (nightmorph)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110812193456.54FD02004C@flycatcher.gentoo.org \
    --to=swift@gentoo.org \
    --cc=docs-team@lists.gentoo.org \
    --cc=gentoo-doc-cvs@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox