Service does not support chkconfig error
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.
Copyright secured by Digiprove © 2009
loading...
loading...

This worked. You’re a fucken awesome cunt
loading...
loading...
Hi there I’m glad this worked
Let me know if I can help with something else.
Lethe.
loading...
loading...
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
))
loading...
loading...
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.
loading...
loading...