[BACK]Return to ngircd-redhat.init CVS log [TXT][DIR] Up to [local] / ircnowd / contrib

Annotation of ircnowd/contrib/ngircd-redhat.init, Revision 1.1.1.1

1.1       tomglok     1: #!/bin/sh
                      2: #
                      3: # ngIRCd start and stop script for RedHat based distributions.
                      4: # Written by Naoya Nakazawa <naoya.n@gmail.com> for CentOS 5.2, 2009.
                      5: #
                      6: # chkconfig: 2345 01
                      7: # description: ngIRCd is an Open Source server for \
                      8: #              the Internet Relay Chat (IRC), which \
                      9: #              is developed and published under \
                     10: #              the terms of the GNU General Public
                     11: #              Licence (URL: http://www.gnu.org/licenses/gpl.html). \
                     12: #              ngIRCd means "next generation IRC daemon", \
                     13: #              it's written from scratch and not deduced from the \
                     14: #              "grandfather of IRC daemons", the daemon of the IRCNet.
                     15: #
                     16: # processname: /usr/sbin/ngircd
                     17: # config: /etc/ngircd
                     18: # pidfile: /var/run/ngircd.pid
                     19:
                     20: PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
                     21: DAEMON=/usr/sbin/ngircd
                     22: NAME=ngIRCd
                     23: BASENAME=ngircd
                     24: CONF=/etc/$BASENAME.conf
                     25: DESC="IRC daemon"
                     26: PARAMS="-f $CONF"
                     27:
                     28: # Source function library.
                     29: . /etc/init.d/functions
                     30:
                     31: # Get config.
                     32: test -f /etc/sysconfig/network && . /etc/sysconfig/network
                     33: test -f /etc/sysconfig/makuosan && . /etc/sysconfig/makuosan
                     34:
                     35: # Check that networking is up.
                     36: [ "${NETWORKING}" = "yes" ] || exit 0
                     37:
                     38: [ -x $DAEMON ] || exit 1
                     39: [ -f $CONF ] || exit 2
                     40:
                     41: RETVAL=0
                     42:
                     43: start(){
                     44:     echo -n $"Starting $NAME: "
                     45:     daemon $DAEMON $PARAMS
                     46:     RETVAL=$?
                     47:     [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$BASENAME
                     48:     echo
                     49:     return $RETVAL
                     50: }
                     51:
                     52: stop(){
                     53:     echo -n $"Stopping $NAME: "
                     54:     killproc $DAEMON
                     55:     RETVAL=$?
                     56:     if [ $RETVAL -eq 0 ] ; then
                     57:         rm -f /var/lock/subsys/$BASENAME
                     58:     fi
                     59:     echo
                     60:     return $RETVAL
                     61: }
                     62:
                     63: reload(){
                     64:     echo -n $"Reloading configuration: "
                     65:     killproc $DAEMON -HUP
                     66:     RETVAL=$?
                     67:     echo
                     68:     return $RETVAL
                     69: }
                     70:
                     71: restart(){
                     72:     stop
                     73:     start
                     74: }
                     75:
                     76: condrestart(){
                     77:     [ -e /var/lock/subsys/$BASENAME ] && restart
                     78:     return 0
                     79: }
                     80:
                     81: check_config(){
                     82:      $DAEMON $PARAMS --configtest >/dev/null 2>&1
                     83:      [ $? -eq 0 ] && return 0
                     84:
                     85:      echo -n $"Configuration of $NAME is not valid, won't (re)start!"
                     86:      echo -n $"Run \"$DAEMON --configtest\" and fix it up ..."
                     87:      exit 6
                     88: }
                     89:
                     90: # See how we were called.
                     91: case "$1" in
                     92:     start)
                     93:         check_config
                     94:        start
                     95:        ;;
                     96:     stop)
                     97:        stop
                     98:        ;;
                     99:     status)
                    100:        status $NAME
                    101:        ;;
                    102:     restart)
                    103:        restart
                    104:        ;;
                    105:     reload)
                    106:        reload
                    107:        ;;
                    108:     condrestart)
                    109:        condrestart
                    110:        ;;
                    111:     test)
                    112:         check_config
                    113:         ;;
                    114:     *)
                    115:        echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|test}"
                    116:        RETVAL=1
                    117: esac
                    118:
                    119: exit $RETVAL

CVSweb