init.d script not executing and missing from chkconfig
MandrivaThis Forum is for the discussion of Mandriva (Mandrake) Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
init.d script not executing and missing from chkconfig
I have a startup script in init.d that does not get executed on either startup or shutdown. It works fine from command line (/etc/rc.d/init.d/xxxxxxxx start|stop) The proper links exist in rc?.d. Specifically the link exists as S96xxxxxx in rc5.d and K00xxxxxx everywhere else. When I run 'chkconfig' it does not show up in the list. I assume that is also the reason it does not work on startup or shutdown. Ownership and permissions on the script and links match all the other scripts and links. Can someone point me in the right direction on this? TIA.
Well, first examine the man page for chkconfig. There is detail there you seem to have missed that should set some light on the subject. In particular attend the --add option.
Before you experiment: examine one of the other scripts in init.d that DOES appear in the chkconfig list. See those comments in the first 24 lines? The ones that refer to chkconfig are critical. They determine how and where chkconfig -add will install the automation lines for starting and stopping the script at different runlevels.
Make sure that your script conforms and contains the comments that will result in the desired behavior. Then try adding it. If it looks wrong, you can always --delete it, modify the comments, and --add it again later.
Finally: once the script is installed properly, the "service <script name> start" and service stop commands should work. You should never need to run it directly again.
Thanks for the info which was a surprise. I'm from the old school where all that was done manually and seems easy. For me this chkconfig seems unnecessarily complicated. Anyway, I have it set up the way I think it should be and it now shows up in the chkconfig list correctly. However, it still is not working and examining the log files there is still something wrong. I can see a usage error for the script complaining a supplied parameter is not 'start' or 'stop'. Perhaps it does a 'status' or something first which I don't handle but then the documentation on this is very sketchy. Anyway, later in the log it appears that it does get executed with a proper parameter. However, for a shutdown I have the parameter 'Required-Stop: $network'. I am guessing (I can't find any documentation on these parameters) that means the network is required for stopping this service. However, looking at the alphabetical list in rc0.d, it is executed after the network shutdown script, not before, so the graceful shutdown fails. In rc5.d, it does appear to be executing after the network start script which is correct but without a graceful shutdown, I can't tell if the service is really starting properly.
1. Yeah, but imagine how simple it make the install/update scripts! The maintainers must LOVE it!
2. If it is not working, perhaps there is a reason why that can be discovered. Can you provide a copy of the script? How about a description of what you expect it to do?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.