/etc/init.d/mydns

Discussion in 'HOWTO-Related Questions' started by nr-one, Jun 26, 2009.

  1. nr-one

    nr-one New Member

  2. falko

    falko Super Moderator Howtoforge Staff

    Code:
    #!/bin/bash
    #
    # mydns        This starts and stops mydns.
    #
    # chkconfig: 345 65 50
    # description: A database-driven DNS server
    #
    # processname: /usr/sbin/mydns
    # config: /etc/mydns.conf
    # pidfile: /var/run/mydns.pid
    
    PATH=/sbin:/bin:/usr/bin:/usr/sbin
    prog=mydns
    
    # Source function library.
    . /etc/init.d/functions
    
    [ -f /usr/sbin/mydns ] || exit 1
    [ -f /etc/mydns.conf ] || exit 1
    
    RETVAL=0
    
    start(){
        echo -n $"Starting $prog: "
    
        daemon $prog -b
        RETVAL=$?
        echo
        touch /var/lock/subsys/mydns
        return $RETVAL
    }
    
    stop(){
        echo -n $"Stopping $prog: "
        killproc $prog
        RETVAL=$?
        echo
        rm -f /var/lock/subsys/mydns
        return $RETVAL
    
    }
    
    restart(){
        stop
        start
    }
    
    condrestart(){
        [ -e /var/lock/subsys/mydns ] && restart
        return 0
    }
    
    
    # See how we were called.
    case "$1" in
        start)
            start
            ;;
        stop)
            stop
            ;;
        status)
            status $prog
            ;;
        restart|reload)
            restart
            ;;
        condrestart)
            condrestart
            ;;
        *)
            echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
            RETVAL=1
    esac
    
    exit $RETVAL
    
    
     
  3. idsinc

    idsinc New Member

    what file is this? is it named "mydns.conf "???
     
  4. falko

    falko Super Moderator Howtoforge Staff

    No, it's /etc/init.d/mydns (without any extension).
     

Share This Page