From a145ddda284570e57413e37f025c3657205e17d8 Mon Sep 17 00:00:00 2001 From: "David Kaspar [Dee'Kej]" Date: Fri, 25 May 2018 20:01:54 +0200 Subject: Repository scheme updated to new layout NOTE: This commit just moves files around, without actually fixing the Makefiles and specfile. See follow up commits which resolve this. --- doc/sysvinitfiles | 212 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 212 insertions(+) create mode 100644 doc/sysvinitfiles (limited to 'doc/sysvinitfiles') diff --git a/doc/sysvinitfiles b/doc/sysvinitfiles new file mode 100644 index 00000000..fcc90b5e --- /dev/null +++ b/doc/sysvinitfiles @@ -0,0 +1,212 @@ +Writing System V init scripts for Red Hat Linux +=============================================== + +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/rc.d/init.d/ +# +# +# +# +# + +# Source function library. +. /etc/init.d/functions + + + +start() { + echo -n "Starting : " + + touch /var/lock/subsys/ + return +} + +stop() { + echo -n "Shutting down : " + + rm -f /var/lock/subsys/ + return +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + + ;; + restart) + stop + start + ;; + reload) + + ;; + condrestart) + + [ -f /var/lock/subsys/ ] && restart || : + probe) + + ;; + *) + echo "Usage: {start|stop|status|reload|restart[|probe]" + exit 1 + ;; +esac +exit $? + +Notes: + +- The restart and reload functions may be (and commonly are) + combined into one test, vis: + restart|reload) +- You are not prohibited from adding other commands; list all commands + which you intend to be used interactively to the usage message. +- Notice the change in that stop() and start() are now shell functions. + This means that restart can be implemented as + stop + start + instead of + $0 stop + $0 start + This saves a few shell invocations. + +Functions in /etc/init.d/functions +======================================= + +daemon [ --check ] [ --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] + + Sends a signal to the program; by default it sends a SIGTERM, + and if the process doesn't die, it sends a SIGKILL a few + seconds later. + + It also tries to remove the pidfile, if it finds one. + +pidofproc program + + Tries to find the pid of a program; checking likely pidfiles, + and using the pidof program. Used mainly from within other + functions in this file, but also available to scripts. + +status program + + Prints status information. Assumes that the program name is + the same as the servicename. + + +Tags +==== + +# chkconfig: + + Required. is a list of levels in which + the service should be started by default. + and are priority numbers. For example: + # chkconfig: 2345 20 80 + Read 'man chkconfig' for more information. + + 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 '\' + characters. The initial comment and following whitespace + on the following lines is ignored. + +# description[ln]: + + Optional. Should be the description translated into the + specified language. + +# processname: + + Optional, multiple entries allowed. For each process name + started by the script, there should be a processname entry. + For example, the samba service starts two daemons: + # processname: smdb + # processname: nmdb + +# config: + + Optional, multiple entries allowed. For each static config + file used by the daemon, use a single entry. For example: + # config: /etc/httpd/conf/httpd.conf + # config: /etc/httpd/conf/srm.conf + + Optionally, if the server will automatically reload the config + file if it is changed, you can append the word "autoreload" to + the line: + # config: /etc/foobar.conf autoreload + +# pidfile: + + Optional, multiple entries allowed. Use just like the config + entry, except that it points at pidfiles. It is assumed that + the pidfiles are only updated at process creation time, and + not later. The first line of this file should be the ASCII + representation of the PID; a terminating newline is optional. + Any lines other than the first line are not examined. + +# probe: true + + Optional, used IN PLACE of processname, config, and pidfile. + If it exists, then a proper reload-if-necessary cycle may be + achieved by running these commands: + + 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. + + Scripts that need to do complex processing could, as an + example, return "run /var/tmp/