Pages

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
Kuldeep

bash: ./iptest.sh: /bin/bash: bad interpreter: Permission denied

Hello All,
               Recently I have faced an interesting issue during command execution. I have given executable permission, But still getting permission denied error like "bash: ./iptest.sh: /bin/bash: bad interpreter: Permission denied"

I have done some searching and finally found exact issue. Actually I was working on my externally USB hard Disk. So by default it mounts with executable permission. Let me show you below:

Before doing any changes(default mount)
[root@server199 scripts]# ./iptest.sh
bash: ./iptest.sh: /bin/bash: bad interpreter: Permission denied

Now I have check default permission on mounted Disk

[root@server199 ~]# mount | grep disk
/dev/sdb1 on /media/disk type vfat (rw,noexec,nosuid,nodev,shortname=winnt,uid=0)

So its mounted with noexec Permission.

Now remount Disk with Executable permissions as shown below and then check:

[root@server199 ~]# cd

[root@server199 ~]# mount -t vfat /dev/sdb1 /media/disk/ -oremount,rw,exec,nosuid,nodev

[root@server199 ~]# mount | grep disk
/dev/sdb1 on /media/disk type vfat (rw,nosuid,nodev)

[root@server199 ~]# cd /media/disk/scripts/

[root@server199 scripts]# ./iptest.sh
enter ip adress
192.168.2.102
you have enterde valid ip adress

!Feel free to Ask
:)
Kuldeep