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

Buzz it!
  • Share/Bookmark

2 Comments

  1. Pete

    This worked. You’re a fucken awesome cunt

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

    Lethe.

Leave a Reply

 

Get Adobe Flash playerPlugin by wpburn.com wordpress themes