Originally Posted by michaelk
In a nutshell the files in rc0.d are links to the actual scripts in /etc/init.d. The links start with either a KXX or SXX. The K i.e kill run first in order from 99 - 1 and stop the associated process. The SXX i.e. start runs second in numerical and will start the associated process. If you configure your script to start in runlevel 0 with a value of 1 (filename S01myscript) it will run first before anything else shuts down.
sendsigs is the global command to shut down running processes.
Hi there, thanks for the response.
I did know about the symlinks and the run levels. Unfortunately even linking my script as S01script name doesn't work. As a test, one of the things the script does is append the output of "ps -ef | grep mysql" to a file in my Home directory. When I check the file after rebooting, all I see is the grep process, making it clear that mysqld isn't running when the script runs.
Your post did give me another idea though. Instead of using the Sxx scripts, I tried using a Kxx script to run my program instead.
Likewise, I did the same test by appending the output "ps -ef | grep mysql" to a file. This time, I do indeed see the mysqld process is still running when the KXXscript runs. Great. Unfortunately, my program still can't connect.
It connects fine when the system isn't shutting down. So there must be something else preventing it from connecting when being run from the KXX script, even though mysqld is still running at the point. I'll need to investigate this further, but in the meantime if anyone has any other suggestions let me know.