Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 45697 - custom init script ignored on startup
Summary: custom init script ignored on startup
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: x86 Linux
: High normal
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-25 03:18 UTC by Andreas Kotowicz
Modified: 2004-03-28 04:44 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Kotowicz 2004-03-25 03:18:19 UTC
I have a poet database server installed. it comes with a init script. running this init script from the bash "/etc/init.d/poetd start" works. adding it to the default runlevel "rc-update add poetd default" works aswell but it won't get executed on net startup. 

Reproducible: Always
Steps to Reproduce:
1.
2.
3.




here's the init script:

#!/bin/bash	
##############################################################
#
# Startup script for the Poet 6.1 DB Server
#
# Date: 20020221
#
# Autor: jdb 
#
# Ver: 0.2.4
#
# Datei: poetd
#
# daemon Start | Stop | Status | Restart
#
# chkonfig: -99 1
#
#--- POET PATH -----------------------------------------------
# Mit diesem Link wird festgelegt, welche POET-Version genutzt wird.
# Nuetzlich, falls mehrere Versionen von POET installiert sind.
#   ln -s /opt/poetX.Y /opt/turbomed/dbserver
# 
# Mit diesem Link wird die Datei poetd in das init.d Verzeichnis gelinkt.
# Nuetzlich, falls init.d nicht unter /etc liegt.
#   ln -s /opt/turbomed/bin/poetd /etc/init.d/poetd
#
# Links (Start,Stop) in den entsprechenden Runlevel erzeugen.
#   runlevel 1...6 stop 3,5 start
# 

#--- Path --------------------------------------------------

ptserver="/opt/poet61/bin/ptserver"
pt_cfg="/opt/turbomed/linux/config/ptserver.cfg"
pt_su="/opt/poet61/bin/ptsu"
LD_LIBRARY_PATH="/opt/poet61/lib"
pt_lock="/var/lock/subsys/poetd"

#--- Name ---
PROG_NAME="ptserver"

###############################################################
#
#             ! ab hier nicht editieren !
#
###############################################################

# System PATHs
PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin

#--- Start ----------------------------------------------------

start()
    {
    export LD_LIBRARY_PATH
    PROG_GID=`pidof -s $PROG_NAME`
    
    #--- test ob schon runing ..
    if [ ! -x $PROG_GID ]
	then
	    #--- das Prog leuft schon ----------------------
	    echo "ist schon runing Prog $PROG_NAME pid: $PROG_GID"
	    #-----------------------------------------------
	else
	    #--- Start vom Prog ----------------------------

	    # Ueberpruefung PTserver 	    
	    if [ ! -x $ptserver ] 
		then
		    echo "ERORR PTServer!"
		    exit 1
	    fi
	    
	    # Ueberpruefung PTserverconfig 
	    if [ ! -f $pt_cfg ] 
		then
		    echo "ERORR PTServer config!"
		    exit 1
	    fi

	    # Start PTServer 
	    # noch mal endern "JDB" 
	    #
	    echo "START $PROG_NAME"
	    $ptserver -config $pt_cfg &
	    
	    sleep_
	    while test $(date +%S) -lt 120
	    do	     
	    PROG_GID=`pidof -s $PROG_NAME`	   
	    #--- test ob schon runing ..
	    if [ ! -x $PROG_GID ]
		then
		#--- das Prog leuft  -----------------------
		echo "RUN $PROG_NAME  pid: $PROG_GID"
		echo > $pt_lock
		exit 0
		#-------------------------------------------
		else
		#-----
		echo -n "#"
	    fi	
	    done

#-------------------------------------------------------------------------
    fi
    echo "ERORR $PROG_NAME nicht aktiv ... !!"
    }

#--- Stop -----------------------------------------------------

stop()
    {
    # Stop PTServer
    PROG_GID=`pidof -s $PROG_NAME`

    if [ ! -x $PROG_GID ]
	then
	    echo "KILL Prog: $PROG_NAME mit gid: $PROG_GID"
	    kill -9 $PROG_GID
	else
	    echo "STOP ?"
	    exit 1
    fi

    sleep_

    PROG_GID=`pidof -s $PROG_NAME`
    if [ ! -x $PROG_GID ]
	then
	    echo "RUN $PROG_NAME ( oder ein zweites Prog $PROG_NAME )"
	else
	    echo "STOP $PROG_NAME"
	    rm -f $pt_lock
    fi
    }

#--- Status -----------------------------------------------------

status()
    {
    # status PTServer

    PROG_GID=`pidof -s $PROG_NAME`
    if [ ! -x $PROG_GID ]
	then
	    echo "RUN $PROG_NAME pid: $PROG_GID"
	else
	    echo "STOP $PROG_NAME"
    fi
    	    
    # Ueberpruefung PTserver 	    
    if [ ! -x $ptserver ] 
	then
	    echo "ERORR PTServer!"
    fi
	    
    # Ueberpruefung PTserverconfig 
    if [ ! -f $pt_cfg ] 
	then
	    echo "ERORR PTServer config!"
    fi
    }

#--- sleep ----------------------------------------------------

sleep_()
    {
	sleep 5
    }

#--- See how we were called ----------------------------------

case "$1" in
  start)
    # 3 * start
    start
    start
    start
    ;;
  stop)
    stop
    ;;
  status)
    status
    ;;
  restart)
    stop
    sleep_
    start
    ;;
  *)
    echo $"Usage: $0 {start|stop|status|restart}"
    exit 1
esac
exit 0

#--- END ---------------------------------------------------
Comment 1 Seemant Kulleen (RETIRED) gentoo-dev 2004-03-26 00:35:12 UTC
you don't have a depend() section in it.  Please see the rc-script guide on www.gentoo.org in the docs section.
Comment 2 Andreas Kotowicz 2004-03-26 00:41:16 UTC
in the docs: http://www.gentoo.org/doc/en/handbook/handbook.xml?part=2&chap=5#doc_chap4

I read:

"Any init script requires the start() function to be defined. All other sections are optional."

So now: Do I need this depend() section, yes or no?
Comment 3 Seemant Kulleen (RETIRED) gentoo-dev 2004-03-26 01:15:59 UTC
try adding one
Comment 4 Andreas Kotowicz 2004-03-26 04:20:23 UTC
added 

depend() {
        need net
}

still doesn't get executed on boot
Comment 5 SpanKY gentoo-dev 2004-03-28 00:09:56 UTC
gentoo-ify that script and then we'll talk
Comment 6 Andreas Kotowicz 2004-03-28 04:44:57 UTC
fair enough. so, generally speaking no genuine redhat or suse init script works on gentoo out of the box but has to be converted, right?