I'm running Red Hat 5.1. I have a script called sysinit that I added as a service using chkconfig --add sysinit. I have the following set in the file:
#chkconfig 4 01 01
This creates one symlink in my rc4.d directory for S01sysinit. However, I want the script to be run on startup and shutdown. No matter what I do, I cannot get a custom script (Service) to run on shutdown. I even tried separating out my functionality into two scripts, one to run at S01 and the other to run at K01 but it didn't work. I don't want to have to resort to modifying the rc.sysinit file to do what my script should be doing (I shouldn't have to touch that I would think). The reason I need to do this is because I need to unmount a samba share inside the /opt directory before the rc.sysinit file tries to unmount the /opt directory (right now I get "device is busy" failures because the cifs mount is still there).
Is there something special I need to do so that my script can run on startup and on shutdown and reboot? Can I have a K01sysinit and S01sysinit in the same run level? Or am I misunderstanding how run levels work?
I have the sections for )start and )stop already in the script.