rc.d script to stop not workign

I have a simple script that I have put in all the rc.d directories from 1-6 and have named it K20blah and S20blah .I am on red hat linux and I see that when i do reboot the S20blah is ignored but the K20blah is executed during startup . Any suggestions?

#! /bin/sh
# /etc/init.d/blah
#

# Some things that run always
touch /var/lock/blah

# Carry out specific functions when asked to by the system
case "$1" in
  start)
    echo "Starting script blah " >start.out
    echo "Could do more here"
    ;;
  stop)
    echo "Stopping script blah">stop.out
    echo "Could do more here"
    ;;
  *)
    echo "Usage: /etc/init.d/blah {start|stop}"
    exit 1
    ;;
esac

exit 0

One query:
Do you say that "K" script is getting called while system start up?

Two things:

  1. When you do reboot your "K" scripts won't be called, it is not graceful shutdown of system. Please check for difference between "reboot" and "init 6", it would help.
  2. Proper way is to put script in /etc/init.d, and making symbolic links for rc*.d directories to /etc/init.d with proper "S" and "K" notation.

The script below is actually in /etc/init.d and there are symlinks to /etc/rc.xd directories and I have put the links in all the rc directories.

The problem I am having is the K script is not working when it is rebooted but the S script indeed works when the systems come up .

I want to know what if anything I am doing wrong here . I need the K script to run so we can gracefully shutdown .

There is no different "K" script, can you please try to reboot system using "init 6" and check if "K" script ran or not ?