From 94672d6adaa64bc53fbeda68f32cb294ee576793 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Tue, 22 Aug 2000 15:48:54 +0000 Subject: update documentation --- sysvinitfiles | 87 ++++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 59 insertions(+), 28 deletions(-) (limited to 'sysvinitfiles') diff --git a/sysvinitfiles b/sysvinitfiles index 3a39ed43..73dae34a 100644 --- a/sysvinitfiles +++ b/sysvinitfiles @@ -1,17 +1,20 @@ Writing System V init scripts for Red Hat Linux =============================================== -All System V init scripts are named /etc/init.d/ +All System V init scripts are named /etc/rc.d/init.d/ where is the name of the service. There must be no ".init" suffix. +This path will very likely be moved to /etc/init.d in the future. +Once Red Hat Linux 7.0 is installed, you can access scripts as +/etc/init.d/, via symlinks. Sample Script ============= #!/bin/bash # -# /etc/init.d/ +# /etc/rc.d/init.d/ # # # @@ -23,33 +26,47 @@ Sample Script # mistaken for tags, should they happen to fit the pattern.> # Source function library. -. /etc/init.d/functions +. /etc/rc.d/init.d/functions -case "$1" in - start) - echo -n "Starting services: " +start() { + echo -n "Starting : " touch /var/lock/subsys/ - ;; - stop) - echo -n "Shutting down services: " + return +} + +stop() { + echo -n "Shutting down : " rm -f /var/lock/subsys/ + return +} + +case "$1" in + start) + start + ;; + stop) + stop ;; status) ;; restart) - + stop + start ;; reload) + kill -HUP or by restarting the daemons, in a manner similar + to restart above> ;; + condrestart) + + [ -f /var/lock/subsys/ ] && restart || : probe) ] [ --user ] + [+/-nicelevel] program [arguments] [&] Starts a daemon, if it is not already running. Does other useful things like keeping the daemon from dumping core if it terminates unexpectedly. + + --check : + Check that is running, as opposed to simply the + first argument passed to daemon(). + --user : + Run command as user killproc program [signal] @@ -92,9 +124,8 @@ killproc program [signal] pidofproc program Tries to find the pid of a program; checking likely pidfiles, - using the pidof program, or even using ps. Used mainly from - within other functions in this file, but also available to - scripts. + and using the pidof program. Used mainly from within other + functions in this file, but also available to scripts. status program @@ -116,7 +147,7 @@ Tags Unless there is a VERY GOOD, EXPLICIT reason to the contrary, the should be equal to 100 - - + # description: Required. Several lines of description, continued with '\' @@ -164,8 +195,8 @@ Tags If it exists, then a proper reload-if-necessary cycle may be acheived by running these commands: - command=$(/etc/rd.d/init.d/SCRIPT probe) - [ -n "$command" ] && /etc/init.d/SCRIPT $command + command=$(/etc/rc.d/init.d/SCRIPT probe) + [ -n "$command" ] && /etc/rc.d/init.d/SCRIPT $command where SCRIPT is the name of the service's sysv init script. @@ -178,4 +209,4 @@ Tags needs to be done to bring the service into sync with its configuration files. -Copyright (c) 1998 Red Hat Software, Inc. +Copyright (c) 2000 Red Hat Software, Inc. -- cgit v1.2.1