init.d scripts runs at rc5.d, not rc0.d

Brian Millett bpm at ec-group.com
Tue Apr 6 13:13:30 UTC 2004


Hi, I have the latest rawhide updates (except for --exclude=Canna*
--exclude=kinput2-canna-wnn6 --exclude=nvi-m17n-canna).  I have a script
to start Jetty.

chkconfig jettyctl --list
jettyctl        0:off   1:off   2:on    3:on    4:on    5:on    6:off

The problem is that when I start up, the script runs just fine for
runlevel 5.  When I shutdown, or reboot, then the script does not run
for the 0, or 6 runlevel.  

So, what causes a script to run for level 0 or 6?  Just having a
K20jettyctl does not seem to do the trick.  I noticed that I have many
scripts in rc0.d that do not run, or at least i can not get them to run
at shutdown.  Can someone enlighten me as to what causes a stop to run
on shutdown?

thanks.

Here are the files:
shaka: find . | grep jetty
./init.d/jettyctl
./init.d/jettyctl~
./rc0.d/K20jettyctl
./rc1.d/K20jettyctl
./rc2.d/S80jettyctl
./rc3.d/S80jettyctl
./rc4.d/S80jettyctl
./rc5.d/S80jettyctl
./rc6.d/K20jettyctl

Here is the script for what it is worth:
#!/bin/bash
#
# jetty        Starts jetty.
#
#
# Comments to support chkconfig on RedHat Linux
# chkconfig: 2345 80 20
# description: Why not use the best servlet engine?

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

echo "RAN: $1 `date`" >>/tmp/jetty

[ -f /opt/jetty/bin/jetty.sh ] || exit 0

LOCKFILE=/var/lock/subsys/jetty
JAVA_HOME=/usr/j2se
JRE_HOME=$JAVA_HOME/jre
LOCKFILE=/var/lock/subsys/jetty
JETTY_HOME=/opt/jetty
JETTY_RUN=$JETTY_HOME
JETTY_PID=$JETTY_HOME/logs/jetty.pid
ENDORSED_LIBS=$JETTY_HOME/endorsed
ENDORSED=-Djava.endorsed.dirs=$ENDORSED_LIBS
PARSER=-Dorg.xml.sax.parser=org.apache.xerces.parsers.SAXParser
JETTY_CONSOLE=$JETTY_HOME/logs/jetty.out
USER_DIR="-Duser.dir=$JETTY_HOME/temp"
LOG4J="-Dlog4j.configuration=file://$JETTY_HOME/etc/log4j.properties"
JAVA_OPTIONS="-server $USER_DIR $LOG4J -Djava.awt.headless=true -Xms32M
-Xmx512M $PARSER $ENDORSED "

#LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/apache/lib
#export LD_LIBRARY_PATH 

export JAVA_HOME JRE_HOME JETTY_HOME JETTY_CONSOLE JETTY_PID JETTY_RUN
JAVA_OPTIONS

START_JETTY=${JETTY_HOME}/bin/jetty.sh
STOP_JETTY=${JETTY_HOME}/bin/jetty.sh
RETVAL=0
ERROR=0
umask 077

case $1 in
  start)
    echo -n "Starting Jetty: "
	su bpm -c "${START_JETTY} start"
	[ $RETVAL = 0 ] && touch $LOCKFILE
	echo
	RETVAL=$?
	;;
  stop)
	echo -n $"Stopping Jetty: "
    PID=`cat $JETTY_PID 2>/dev/null`
    kill $PID 2>/dev/null
	RETVAL=$?
    sleep 2
    kill -9 $PID 2>/dev/null
    rm -f $JETTY_PID
    echo "STOPPED `date`" >>$JETTY_CONSOLE
    echo
	[ $RETVAL = 0 ] && rm -f $LOCKFILE
	[ -f $LOCKFILE ] && rm -f $LOCKFILE
	[ -f $JETTY_PID ] && rm -f $JETTY_PID
	;;
  restart|reload)
	echo -n $"Stopping Jetty: "
	${STOP_JETTY} stop
	RETVAL=$?
    echo
	[ $RETVAL = 0 ] && rm -f $LOCKFILE
	[ -f $LOCKFILE ] && rm -f $LOCKFILE
	[ -f $PIDFILE ] && rm -f $PIDFILE
 	echo -n $"Starting Jetty: "
	su bpm -c "${START_JETTY} start"
	[ $RETVAL = 0 ] && touch $LOCKFILE
	echo
	RETVAL=$?
	;;
  *)
	echo $"Usage: $0 {start|stop|restart}"
	exit 1
esac

exit $RETVAL


-- 
Brian Millett  -  Technologist Rex 
"Commander..." 
'Yeah?' 
"I think I've got to go to the bathroom." 
'Tell me about it!' 
   -- Ivanova and Sinclair, "A Voice in the Wilderness I"





More information about the devel mailing list