출처 : http://www.sensi.org/~alec/unix/redhat/sysvinit.html
#!/bin/bash # # /etc/rc.d/init.d/<servicename> # # <description of the *service*> # <any general comments about this init script> # # <tags -- see below for tag definitions. *Every line* from the top # of the file to the end of the tags section must begin with a # # character. After the tags section, there should be a blank line. # This keeps normal comments in the rest of the file from being # mistaken for tags, should they happen to fit the pattern.> # Source function library. . /etc/rc.d/init.d/functions # <define any local shell functions used by the code that follows> case "$1" in start) echo -n "Starting <servicename> services: " <start daemons, perhaps with the daemon function> touch /var/lock/subsys/<servicename> ;; stop) echo -n "Shutting down <servicename> services: " <stop daemons, perhaps with the killproc function> rm -f /var/lock/subsys/<servicename> ;; restart) $0 stop $0 start ;; *) echo "Usage: <servicename> {start|stop|restart}" exit 1 ;; esac