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

Service does not support chkconfig error

November 12th, 2010 Leave a comment Go to comments

chkconfig 150x150 Service does not support chkconfig error

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 scriptname 

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 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:

#!/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 :

 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.

VN:F [1.9.20_1166]
Rating: 3.6/5 (9 votes cast)
Service does not support chkconfig error, 3.6 out of 5 based on 9 ratings

Incoming search terms:

Categories: Featured, Linux How to
  • DerekC

    note: the “chkconfig” line should also be a comment

  • Abcd360

    thanks !How to better understand priority 95, I have met the problem“only one runlevel may be specified for a chkconfig query” 

    • Abcd360

      i have deal with.i just lost “on”.

  • Nabil Tawfik

    very helpful

  • Pingback: Arrdino » Blog Archive » chkconfig-ify an exising init script. - Linux, life and programming

  • P. Almonius

    thanks, the lack of a description was why my init script gave the ‘does not support chkconfig’ message

    • http://blog.tuxforge.com Lethe

      Yup that’s the most common problem when configuring a new init script, glad you solved it!

      Cheers Lethe