I have a samba mount located within /opt. I have a script in init.d called sysinit that is linked to in rc6.d. This gets called on a reboot (the first thing, I set it to K01sysinit) and it is supposed to unmount the /opt directory. However, on reboot I see that it is failing from the commands in the rc.sysinit file. When I manually run my sysinit script and then reboot, everything works fine. Am I running into some sort of race condition here where the rc.sysinit umount command is getting run before the other script is done unmounting /opt, or is something else going on? Or do I not understand how run levels work? I thought that what happened on a reboot is that the stuff from rc6.d is run first and then the unmounting from rc.sysinit occurs.
The solution I found was that I needed to create a lock file in /var/lock/subsys so that the rc.sysinit file knew that the service I created was "running". Without that, it would never create the KXXsysinit symlinks necessary so that my script would be run with a "stop" command on shutdown or reboot.