Anatomy Of A Pyschopath

P { margin-bottom: 0.08in; }

CentOS 6 has a simple command-line tool
for managing services that are started during the various runlevels of your
system.

Most applications and services will
include their own initialization script and these will be installed to /etc/init.d, but over the
life time of the server you may wish to use or write your own custom service that will
require manual installation. You may even want to troubleshoot an
existing service, but whatever the reasons, here we look at how it can be achieved.

It is assumed that you have already
installed a custom service and that you know the name of this custom service.

Log in as root and page through the
list of current services

# chkconfig ­–list | less

Depending on the number of services
running on your server, this

command may display a long list of
services. For this reason you

may want to use the grep tool

# chkconfig –list | grep[servicename]

If you know the name of the service you
can use

# chkconfig –list [servicename]
Centos 6 Chkconfig command
If the application or service you are
looking for is not shown, then simply add the new service to the chkconfig management
tool by using the following command and replacing servicename with the name of
the service in question

# chkconfig –add [servicename]

When an application or service is
installed the initialization script is generated and automatically
added to the /etc/init.d. If you have difficulty in identifying the
name of your service, visit /etc/init.d, locate the appropriate
script and obtain the service name from its contents.

The appropriate links are then created
automatically, but in order to enable the service or application at startup, you
will need to type the following command by replacing ‘[servicename]’ with the service
name in question and customizing the runlevels as required

# chkconfig –levels 235 [servicename]
on

As an alternative, you can simply use 

# chkcongfig [servicename] on.

When complete, you can confirm if this
process was successful

# chkconfig –list [servicename]

                A full list of runlevels
  
0 Halt: This is the runlevel at which the system shuts down and is unsuitable for any type of application or service.

1 Single-User mode: This runlevel does not start any networking or multiuser services, but it does boot the system into single-user mode under which only the root user can log in. This runlevel is ideal for system administrators who wish to perform system maintenance or repair activities.

2 Multi-user mode, console logins only (without networking): This runlevel does not start the network but it does boot the system into a multiuser environment with text-based console login capability.
               
3 Multi-User mode, console logins only: This runlevel gives all the features of runlevel 2, but it provides full networking services. This is the most common runlevel for server-based systems that do not require or use a graphical desktop environment.
               
4 Not used/User-definable: This runlevel is undefined and can be
               configured to provide a custom environment.

5 Multi-User mode, with display manager as well as console logins (X11): This runlevel is similar to runlevel 3, but is generally associated for systems with desktop environments.

6 Reboot: This runlevel reboots the system and is unsuitable for any type of application or service.

To initialize the Apache web service during the boot process at runlevels 2, 3 and 5 you would use the chkconfig command

# chkconfig –levels 235 httpd on

Whereas MySQL will look like this

# chkconfig –levels 235 mysqld on

The chkconfig tool will only affect the service in question at the next reboot. If you do not require a reboot and in order to start you service immediately you can use

# service [servicename] start

Basic chkconfig command syntax is as below

  
# chkconfig [–list] [–type <type>] [name]
# chkconfig –add <name>
# chkconfig –del <name>
# chkconfig –override <name>
# chkconfig [–level <levels>] [–type <type>] <name> <on|off|reset|resetpriorities>

Author: Paul Anthony McGowan

Web Technology & Linux Enthusiast, Javascript Afficiado, General Observer Of World Corruption. Builder Of A Variety Of Web Properties And Campaigner Against Serious Government Criminality. Founder of Vorteasy

Leave a Reply

Your email address will not be published. Required fields are marked *