Skip site navigation (1)Skip section navigation (2)
Date:      16 Aug 2001 11:37:37 -0000
From:      Mike Meyer <mwm@mired.org>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   docs/29771: [PATCH] rc(8) man page has an out of date description of rc.d scripts
Message-ID:  <20010816113737.29747.qmail@guru.mired.org>

next in thread | raw e-mail | index | archive | help

>Number:         29771
>Category:       docs
>Synopsis:       [PATCH] rc(8) man page has an out of date description of rc.d scripts
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-doc
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 16 04:40:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Mike Meyer
>Release:        FreeBSD 4.4-PRERELEASE i386
>Organization:
Meyer Consulting
>Environment:
System: FreeBSD guru.mired.org 4.4-PRERELEASE FreeBSD 4.4-PRERELEASE #3: Sun Aug 12 05:20:48 CDT 2001 mwm@guru.mired.org:/sharetmp/obj/usr/src/sys/GURU i386

>Description:

The rc(8) man page describes rc.d scripts, and even includes a sample
script. However, it only discuses the "start" option, and ignores the
"stop" option used by rc.shutdown.

>How-To-Repeat:

	$ man rc

>Fix:

The attached patch adds a description of the shutdown time
requirements for the scripts. It also extends the example to handle
"stop", and changes the error case to be a slightly more standard
"usage" message and to cause the script to indicate an error on exit.

There should be a better place to put this stuff, but I'm not sure
where that would be.

--- rc.8	Sat Jul 21 09:08:34 2001
+++ /tmp/rc.8	Thu Aug 16 06:00:16 2001
@@ -71,7 +71,7 @@
 The
 .Nm rc.d
 directories contain scripts which will be automatically
-executed at boot time.
+executed at boot and shutdown time.
 The specified directories are processed immediately after
 .Nm rc.local
 is executed.
@@ -88,13 +88,20 @@
 Any other files or directories present within the directory are silently
 ignored.
 .It
-When a script is executed, it is passed the string
+When a script is executed at boot time, it is passed the string
 .Dq start
 as its first and only argument.
 All
 .Nm rc.d
 scripts expected to handle this argument appropriately.
 .It
+When a script is executed at shutdown time, it is passed the string
+.Dq stop
+as its first and only argument.
+All
+.Nm rc.d
+scripts expected to handle this argument appropriately.
+.It
 The scripts within each directory are executed in lexicographical order.
 If a specific order is required,
 numbers may be used as a prefix to the existing filenames,
@@ -222,12 +229,17 @@
 #
 #    initialization/shutdown script for foobar package
 
+PIDFILE=/var/run/foo.pid
 case "$1" in
 start)
-	/usr/local/sbin/foo -d && echo -n ' foo'
+	/usr/local/sbin/foo -d -f $PIDFILE && echo -n ' foo'
+	;;
+stop)
+	kill `cat $PIDFILE` && echo -n ' foo'
 	;;
 *)
-	echo "unknown option: $1 - should be 'start'" >&2
+	echo "usage: `basename $0` {start|stop}" >&2
+	exit 1
 	;;
 esac
 .Ed

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-doc" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010816113737.29747.qmail>