LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Mandriva (https://www.linuxquestions.org/questions/mandriva-30/)
-   -   init.d script not executing and missing from chkconfig (https://www.linuxquestions.org/questions/mandriva-30/init-d-script-not-executing-and-missing-from-chkconfig-845123/)

gw1500se 11-18-2010 12:30 PM

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.

wpeckham 11-18-2010 02:23 PM

chkconfig and init.d script
 
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.

gw1500se 11-18-2010 06:08 PM

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.

wpeckham 11-19-2010 11:27 AM

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?


All times are GMT -5. The time now is 12:03 PM.