RHEL/CentOS 6의 경우 /usr/share/doc/initscripts-9.03.40/sysvinitfiles 에서 샘플 스크립트와 문서를 찾을 수 있다.
Functions in /etc/init.d/functions
daemon [ --check <name> ] [ --user <username>] [+/-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 that <name> is running, as opposed to simply the first argument passed to daemon().
Run command as user <username>
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.
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.
Prints status information. Assumes that the program name is the same as the servicename.
# chkconfig: <startlevellist> <startpriority> <endpriority>
Required. <startlevellist> is a list of levels in which the service should be started by default.
<startpriority> and <endpriority> are priority numbers. For example:
Read 'man chkconfig' for more information.
Unless there is a VERY GOOD, EXPLICIT reason to the
contrary, the <endpriority> should be equal to
100 - <startpriority>
# description: <multi-line description of service>
Required. Several lines of description, continued with '\' characters. The initial comment and following whitespace on the following lines is ignored.
Optional, multiple entries allowed. For each static config file used by the daemon, use a single entry. For example:
Optionally, if the server will automatically reload the config file if it is changed, you can append the word "autoreload" to the line:
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.
- Create init script in CentOS 6
This page has no comments.