Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 12-07-2006, 07:32 PM   #1
Registered: Oct 2005
Posts: 324

Rep: Reputation: 32
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

#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.

Old 12-07-2006, 08:19 PM   #2
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677
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:
# 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.

Last edited by jschiwal; 12-07-2006 at 08:43 PM.
Old 12-18-2006, 10:23 PM   #3
Registered: Oct 2003
Location: Ohio
Distribution: Fedora 25, 26, RHL 5.2
Posts: 560

Rep: Reputation: 56
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.


Last edited by wmakowski; 12-18-2006 at 10:26 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to register auto start/stop service script with chkconfig travellers Linux - Software 8 06-15-2009 11:02 AM
solaris equivalent of chkconfig and service of redhat linux sanjeevkchopra Solaris / OpenSolaris 3 07-11-2006 03:45 PM
AIX equivalent of chkconfig and service in redhat linux sanjeevkchopra AIX 1 07-11-2006 10:07 AM
I can't "service squid start" , and chkconfig squid on not working Niceman2005 Linux - Software 0 11-10-2004 08:18 PM
Oracle does not support chkconfig puzz_1 Linux - Software 1 07-31-2003 01:18 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:32 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration