[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

/etc/rc*.d/K05st.exmple not executed when the system is shut down



I have a dummy startup file st.example in /etc/init.d (see below), which has been added to the system run levels as
 
[root srv]# chkconfig --list st.example
st.example      0:off   1:off   2:off   3:on    4:off   5:off   6:off

 [root srv]# ls /etc/rc*.d/*st.example /etc/rc0.d/K05st.example  /etc/rc3.d/S92st.example  /etc/rc6.d/K05st.example /etc/rc1.d/K05st.example  /etc/rc4.d/K05st.example /etc/rc2.d/K05st.example  /etc/rc5.d/K05st.example

 
When I shut down the system, "stop" (or K05st.example) somehow is never executed (I don't see the log file in /tmp, and I don't see the shutdown message in /var/log/messages after the system is back up.). "start" always works as expected when the system comes up.
 
Am I missing any?
 
Thanks for any help.
Jingchen
 
[root srv]# cat /etc/init.d/st.example 
#!/bin/sh 
# chkconfig: 3 92 05 # description: a daemon template #==============================================================
#
#  Abs:   Type I startup
#
#  Name:  st.example
#
#  Rem:   This shell script calls type II startup file
#
#  Usage: st.example {start|stop}
#
#  Auth:  14-Mar-2007, Jingchen Zhou   (jingchen)
#  Rev:   dd-mmm-yyyy,  Whoever    (user):
#
#--------------------------------------------------------------
CMD=st.example
# Source function library.
. /etc/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
RETVAL=0
start() {
    echo -n "Starting ${CMD}: "
    RETVAL=$?
    [ "$RETVAL" -eq 0 ] && success "${CMD} startup" || failure "${CMD} startup"
}
stop() {
    echo -n "Shutting down ${CMD}: " > /tmp/${CMD}.log 2>&1
    RETVAL=$?
    [ "$RETVAL" -eq 0 ] && success "${CMD} shutdown" || failure "${CMD} shutdown"
}
# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        stop
        sleep 3
        start
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart}"
        exit 1
esac
exit $RETVAL



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]