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.
Incoming search terms:
- service does not support chkconfig
- service does not support chkconfig centos
- does not support chkconfig
- service squid does not support chkconfig
- service glassfish does not support chkconfig
- service nginx does not support chkconfig
- service does not support chkconfig linux
- service does not support chkconfig redhat
- centos service does not support chkconfig
- linux service does not support chkconfig