From owner-freebsd-doc Thu Aug 16 4:40:15 2001 Delivered-To: freebsd-doc@freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 5E56B37B40A for ; Thu, 16 Aug 2001 04:40:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id f7GBe1k52212; Thu, 16 Aug 2001 04:40:01 -0700 (PDT) (envelope-from gnats) Received: from guru.mired.org (okc-27-141-144.mmcable.com [24.27.141.144]) by hub.freebsd.org (Postfix) with SMTP id E86D737B40F for ; Thu, 16 Aug 2001 04:37:37 -0700 (PDT) (envelope-from mwm@mired.org) Received: (qmail 29748 invoked by uid 100); 16 Aug 2001 11:37:37 -0000 Message-Id: <20010816113737.29747.qmail@guru.mired.org> Date: 16 Aug 2001 11:37:37 -0000 From: Mike Meyer Reply-To: Mike Meyer To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: docs/29771: [PATCH] rc(8) man page has an out of date description of rc.d scripts Sender: owner-freebsd-doc@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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