Tuesday, September 6, 2011

Service does not support chkconfig error

Hi Friends,
                  As u all know in Redhat or other derived distros to add any service to runlevel we make use of chkconfig  command as given below:

#chkconfig --level *runlevel* *service name* on/off

But before that we have to add that particular service to chkconfig, without adding this we can not run above command. So to add a service to chkconfig use following syntax:

#chkconfig --add  *service name*

But sometimes what happens when we run this command, we get following error message as:  service test does not support chkconfig.

So to this working you have to add following line just after the shebang/hashbang  #!/bin/sh or #!/bin/bash.
#chkconfig: 2345 95 20
# description: Description of the script
# processname:test
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 20 (one of the firsts).

Congratulations next time you’ll boot your server it’ll automatically the configured service, squid in this example.
!Hope this will Help you