HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   HOWTO-Related Questions (http://www.howtoforge.com/forums/forumdisplay.php?f=2)
-   -   MyDNS CentOS start on Reboot (http://www.howtoforge.com/forums/showthread.php?t=2925)

kaptk2 6th March 2006 20:03

MyDNS CentOS start on Reboot
 
When following the MyDNS howto I get to this step:

On Fedora or RedHat, you would run this:

chkconfig --levels 235 mydns on

Upon running that command I get this error message:
service mydns does not support chkconfig

I am running CentOS 4.2 any hints on how to get it so that on a reboot MyDNS will come up.

falko 6th March 2006 22:25

Is /etc/init.d/mydns executable?

kaptk2 6th March 2006 22:33

Yes it is.

# ls -li /etc/init.d/mydns
1378476 -rwxr-xr-x 1 root root 775 Mar 6 11:21 /etc/init.d/mydns

falko 6th March 2006 23:11

Ok, can you post the first lines of any other script in /etc/init.d? I guess you have to add something similar to /etc7init.d/mydns so that the chkconfig program knows what to do.

kaptk2 8th March 2006 18:57

After 2 days of trying to get this to work I still can't figure out what is missing. Here is the /etc/init.d/snmpd script in it entirity. Maybe you can see what I am missing. If you want a diffrent file let me know. SNMP seemed the easist for me to understand.

Code:

#!/bin/bash
# ucd-snmp init file for snmpd
#
# chkconfig: - 50 50
# description: Simple Network Management Protocol (SNMP) Daemon
#
# processname: /usr/sbin/snmpd
# config: /etc/snmp/snmpd.conf
# config: /usr/share/snmp/snmpd.conf
# pidfile: /var/run/snmpd

# source function library
. /etc/init.d/functions

OPTIONS="-Lsd -Lf /dev/null -p /var/run/snmpd -a"
RETVAL=0
prog="snmpd"

start() {
        echo -n $"Starting $prog: "
        if [ $UID -ne 0 ]; then
                RETVAL=1
                failure
        else
                daemon /usr/sbin/snmpd $OPTIONS
                RETVAL=$?
                [ $RETVAL -eq 0 ] && touch /var/lock/subsys/snmpd
        fi;
        echo
        return $RETVAL
}

stop() {
        echo -n $"Stopping $prog: "
        if [ $UID -ne 0 ]; then
                RETVAL=1
                failure
        else
                killproc /usr/sbin/snmpd
                RETVAL=$?
                [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/snmpd
        fi;
        echo
        return $RETVAL
}

reload(){
        echo -n $"Reloading $prog: "
        killproc /usr/sbin/snmpd -HUP
        RETVAL=$?
        echo
        return $RETVAL
}

restart(){
        stop
        start
}

condrestart(){
    [ -e /var/lock/subsys/snmpd ] && restart
    return 0
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  reload)
        reload
        ;;
  condrestart)
        condrestart
        ;;
  status)
        status snmpd
        RETVAL=$?
        ;;
  *)
        echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
        RETVAL=1
esac

exit $RETVAL


falko 8th March 2006 20:25

Please put
Code:

# chkconfig: - 21 22
somewhere at the beginning of /etc/init.d/mydns and run
Code:

chkconfig --levels 235 mydns on

kaptk2 8th March 2006 20:50

No good. I am still getting this error message:
service mydns does not support chkconfig

Here is how my file looks now. It is snipped but the rest is what is on the website. Any more hints?

Code:

#! /bin/sh
#
#
# chkconfig: - 21 22
#
# mydns        Start the MyDNS server
#
# Author:      Falko Timme <ft@falkotimme.com>.
#

set -e

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=mydns
DAEMON=/usr/local/sbin/$NAME
DESC="DNS server"


falko 8th March 2006 21:44

You can create the needed system startup links for mydns by hand:

Code:

ln -s /etc/init.d/mydns /etc/rc.d/rc2.d/S21mydns
ln -s /etc/init.d/mydns /etc/rc.d/rc3.d/S21mydns
ln -s /etc/init.d/mydns /etc/rc.d/rc5.d/S21mydns


kaptk2 3rd April 2006 04:54

Fixed It!
 
I finally fixed it so that it works with out manually adding anything. I edited the init script to look like this. And it works now with the instructions provided. It also now show up when you run ntsysv. Hope this helps somebody else in the future.

Code:

#! /bin/sh
# mydns        Start the MyDNS server
# Author:      Falko Timme <ft@falkotimme.com>.

# Comments to support chkconfig on RedHat Linux
# chkconfig: 235 90 90
# description: A DNS server that runs off of a MySQL backend

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=mydns
DAEMON=/usr/local/sbin/$NAME
DESC="DNS server"

SCRIPTNAME=/etc/init.d/$NAME

# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0

case "$1" in
  start)
        echo -n "Starting $DESC: $NAME"
        $DAEMON --background
        echo "."
        ;;
  stop)
        echo "Stopping $DESC: $NAME."
        kill -9 `pidof $NAME` &> /dev/null
        ;;
  restart)
        echo "Restarting $DESC: $NAME."
        $0 stop && sleep 1
        $0 start
        ;;
  *)
        echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2
        exit 1
        ;;
esac

exit 0



All times are GMT +2. The time now is 03:56.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.