I'm working with a software application that's a bit touchy so I wan't to shut the software down automatically on reboot or shutdown. I have created a script an placed it in /etc/init.d/ with a symlink in /etc/rc6.d and named it K99_restofname. The script works great testing it outside of a reboot scenario. The process takes close to a minute to do its work. I do not think its being ran or working when I reboot because the system shuts down way to fast and I should see a delay while the script works. (I'm also watching the screen) I also do not see anything in the logs. Here is my script: #!/bin/bash## # Any subsequent(*) commands which fail will cause the shell     script to exit immediatelyabort(){echo >&2 '****************** ABORTED ******************'echo An error occurred. Exiting... >&2exit 1}trap 'abort' 0set -e## Stopping the application services before the system shuts down. This   must be done by the application user user. VAR=`/bin/su -c /opt/app/bin/command stopall - user`echo $VAR# DONEtrap : 0echo >&2 '*************** DONE *** ************'Can anyone tell me what might be going on or how I can track down custom shutdown scripts? Is there a better way to accomplish my goal than this? My system is RHEL 6 server. 
custom shutdown script in rc6.d does not seem to be working.
bash;shell script;rhel;reboot