Home > How to, Linux > Service does not support chkconfig error

Service does not support chkconfig error

February 26th, 2009 Lethe Leave a comment Go to comments
GD Star Rating
loading...


Hello all, as you know in Red Hat or derived distros to add a particular service to a runlevel you can use the chkconfig command with a syntax similar to the following :

chkconfig –level 2345 <name of the script> 

This works like a charm when you're adding a chkconfig "ready" script but what to do when you wrote your own script and trying to add it to particular runlevel you get the error service does not support chkconfig error?

I ran into this problem this afternoon while trying to add a startup script to start squid services automatically, to solve this problem you just need to add a few lines to your script, for this example I'll be using a sample Squid startup script. If you try to the following script through chkconfig, assuming you've already copied the file to /etc/init.d directory, to your system you'll the the not supported error:

 

1
2
3
4
5
#!/bin/sh
	# this script starts and stops Squid
	start /usr/local/squid/sbin/squid -s
	echo -n Squid
	stop /usr/local/squid/sbin/squid -k shutdown

To make this script chkconfig "compliant" just add the following text right after the shebang line (#!/bin/sh or #!/bin/bash) being sure to include all the # symbols :

 

1
2
3
# chkconfig: 2345 95 20
	# description: Description of the script
	# processname: squid

The first line, even if commented, is used by chkconfig and must be present defines that on runlevels 2,3,4 and 5, this subsystem will be activated with priority 95 (one of the lasts), and deactivated with priority 05 (one of the firsts).

Congratulations next time you'll boot your server it'll automatically the configured service, squid in this example.

I hope you've found this useful, Lethe.

dp seal trans 16x16 Service does not support chkconfig error  Copyright secured by Digiprove © 2009

GD Star Rating
loading...
GD Star Rating
loading...
Related Posts with Thumbnails
Print
Categories: How to, Linux
  1. Pete
    October 27th, 2009 at 04:34 | #1

    This worked. You’re a fucken awesome cunt

    GD Star Rating
    loading...
    GD Star Rating
    loading...
  2. October 27th, 2009 at 08:57 | #2

    Hi there I’m glad this worked :) Let me know if I can help with something else.

    Lethe.

    GD Star Rating
    loading...
    GD Star Rating
    loading...
  3. Staroch
    August 11th, 2010 at 15:29 | #3

    hi, a have some problem with red hat chkconfig, when i try add my dhclient to start up through bash ( chkconfig –add dhclient or some other like chkconfig dhclient on …..) i recieved …..dhcp, isnĀ“t file or directory, could you help me :) ))

    GD Star Rating
    loading...
    GD Star Rating
    loading...
  4. August 11th, 2010 at 15:46 | #4

    Hi there Star, I’m not sure I’ve understood the problem correctly anyhow keep in mind dhclient is a system binary (if memory serves under /sbin/dhclient) and, depending on your configuration, should be called automatically @startup time.

    The above script is used to register a new service, like for example Squid, with the system.

    If your /etc/sysconfig/network/ifcfg-eth0 (path can vary) is set to BOOTPROTO=’dhcp’ dhclient will be invoked automatically and your computer will try to lease an IP address.

    Not sure if this is your problem, but if you can elaborate a bit more I’ll try to help you out.

    Cheer Lethe.

    GD Star Rating
    loading...
    GD Star Rating
    loading...
  1. No trackbacks yet.
CommentLuv Enabled

 

Get Adobe Flash playerPlugin by wpburn.com wordpress themes
This site is protected by WP-CopyRightPro