LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   service foo does not support chkconfig (https://www.linuxquestions.org/questions/linux-newbie-8/service-foo-does-not-support-chkconfig-508380/)

packets 12-07-2006 07:32 PM

service foo does not support chkconfig
 
I have a simple script which I want to add in boot up. I want it to include in startup and I don't want it to add in rc.local.

Below are the sample of the script

#!/bin/bash
#
#chkconfig 2345
# Use to up application
........... --> script

I just notice most of the script in /etc/init.d has

chkconfig 2345 <no#1> <no#2>

Could someone explain to me what is no#1 and no#2? Also is it possible to have the same no#1 and no#2 to some of the scripts in /etc/init.d?

Sorry coz I'm still a newbie.

TIA,

jschiwal 12-07-2006 08:19 PM

The second number is the priority. I'm afraid I don't know what the last entry is is for. Besides reading the service skeleton file ( probably /etc/init.d/skeleton ) and "man chkconfig" you may also want to read the man page for the insserv command. It does more in explaining the contents of the commented headers.
This is a fragment of my /etc/init.d/hplip file:
Code:

# For chkconfig the HPLIP priority (ie: 50) must be less the cupsd
# priority (ie: 55).
#
# For LSB install_initd the cups script file should have "hplip" in the
# Should-Start field.
#
#  chkconfig: 2345 50 10
#  description: Start/stop script for HP Linux Imaging and Printing (HPLIP).
#

Also, you might consider having the script in /etc/init.d stay very close to the model skeleton script, or one of the other scripts that you use as a model. Instead of this script doing the work, have it start, stop, restart, the actual script. There's nothing wrong with using the same start() and stop() functions as one of the other services. The hplip script simply starts the hpiod program. Changing the names of variables so they make more sense and the name of the target program to the name of your script, you could use this or another init.d script almost as is. This would also decouple your script from the init process.

When I grep'ed for "chkconfig" in the init.d scripts, I noticed that most didn't have the chkconfig <runlevels> <priority> <lastentry> line but they all had the instserv header information.

wmakowski 12-18-2006 10:23 PM

First number is priority of starting, the second number is priority of stopping. For each service in rcX.d, where X is 2345, you'll see a corresponding symbolic link in rc6.d. In the above example you will see and entry like S50hplip and a corresponding entry K10hplip. What this does is allow the services to start and stop in a specific order during start up and shutdown.

As another example, networking starts very early having a priority of 10 and stops late during shutdown with a priority of 90.

Bill


All times are GMT -5. The time now is 02:43 PM.