LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 03-05-2008, 09:25 PM   #1
aloneattack
LQ Newbie
 
Registered: Aug 2007
Posts: 11

Rep: Reputation: 0
Help: Startup script


Hi, I'm attempting to create a startup script for krb5kdc daemon to start automatically at the booting of system.
And here is my content of krb5kdc script:

Code:
*************************************************************************************
#! /bin/bash
#
# krb5kdc          Start/Stop the krb5kdc daemon.
#
# chkconfig: - 9 60
# description:
# processname: krb5kdc
# config:
# pidfile:

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

RETVAL=0

# See how we were called.

prog="krb5kdc"

start() {
        echo -n $"Starting $prog: "
        daemon krb5kdc
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/krb5kdc
        return $RETVAL
}

stop() {
        echo -n $"Stopping $prog: "
        killproc krb5kdc
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/krb5kdc
        return $RETVAL
}

rhstatus() {
        status krb5kdc
}

restart() {
        stop
        start
}

reload() {
        echo -n $"Reloading krb5kdc daemon configuration: "
        killproc krb5kdc -HUP
        retval=$?
        echo
        return $RETVAL
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  reload)
        reload
        ;;
  status)
        rhstatus
        ;;
  krb5kdcrestart)
        [ -f /var/lock/subsys/krb5kdc ] && restart || :
        ;;
  *)
        echo $"Usage: $0 {start|stop|status|reload|restart|krb5kdcrestart}"
        exit 1
esac

exit $?

*************************************************************************************
then I place this file in /etc/rc.d/init.d directory and use

chkconfig --add krb5kdc

I got :

service krb5kdc does not support chkconfig

Any suggestion please.

Thank you.
 
Old 03-05-2008, 10:27 PM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Your header doesn't look right. Look at the skeleton file and other service startup scripts as a model. Chkconfig can be thought of as a front end for insserv. You are missing the runlevel and dependency information:
Code:
#! /bin/sh
# Copyright (c) 2000-2001 SuSE GmbH Nuernberg, Germany.
# Copyright (c) 2002 SuSE Linux AG
# Copyright (c) 2005 SUSE LINUX Products GmbH
#
# Author: Carsten Hoeger
# Please send feedback to http://www.suse.de/feedback/
#
# /etc/init.d/postfix
#
### BEGIN INIT INFO
# Provides:       smtp sendmail postfix
# Required-Start: $network $named $syslog $time
# Should-Start: cyrus ldap ypbind openslp amavisd
# Required-Stop:
# Default-Start:  3 5
# Default-Stop:
# Description:    start the Postfix MTA
### END INIT INFO
This isn't from a Red Hat system, so look at the headers on your system and read the insserv manpage.
 
Old 03-06-2008, 03:01 AM   #3
aloneattack
LQ Newbie
 
Registered: Aug 2007
Posts: 11

Original Poster
Rep: Reputation: 0
hi, the line of "*" actually is not in my script, just in my post for getting help, and, I copied the content of a real script in /etc/init.d then attempted to replace appropriate service name.
"-" means auto runlevels, I also replace "-" by 2345 for runlevels 2,3,4,5 but after all still no effort.

Last edited by aloneattack; 03-06-2008 at 03:31 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
'cannot stat' script in /etc/rc.d/, try to run script at startup quintan Linux - Software 1 11-21-2005 02:53 AM
How to call a script from a system startup script? jonatito Linux - Newbie 7 11-11-2005 09:40 PM
wi-fi startup script Nodren Linux - Wireless Networking 6 05-09-2005 08:56 AM
startup script traetox Linux - Networking 3 02-14-2005 06:47 AM
What's a startup script? rdaves@earthlink.net Linux - Newbie 1 05-22-2001 03:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 05:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration