Management of Linux Services

Source: Internet
Author: User
Tags stop script

Introduction to 1.Linux Services

System Services

--the services of some services are targeted at the Linux system itself, or Linux system system users, which we call system service

Network Services

--services that are provided to other client calls in the network, which we collectively refer to as Network services (Networking service)

The method of starting according to service can be divided into

Standalone system Services

--Once the service is started, unless the system is shut down or manually shut down, it is executed in the background, regardless of whether it is used or not, such services are referred to as standalone system services (Sys V service)

Temporary services

--Temporary services (Transient service) usually do not start, when the client needs to start, the use is finished.

2. Service Management

Linux specifically provides a service program startup file for each standalone service (services startup Script)

All boot files are stored in the/ETC/RC.D/INIT.D directory

(if the parameter is not available, try an absolute path to the action)

The action parameters of the startup file are as follows:

Start startup service

Stop Stop Service

Restart Restart Service

Reload overloaded configuration file, when the service is started

Condrestart a conditional reboot, the service must be started before it is restarted, and it does not need to be started if the service has not been started.

Status View the state of the service

Using Service Management Services

Syntax: Service name action

Parameters:

Start

Stop

Status

3. Daemon Process

INETD is a special program that constantly monitors all communication ports. Once a client invokes a startup file, the program is responsible for starting the service, and after the client has finished using it, the program must also be responsible for the end.

Daemon Service location:/ETC/XINETD.D

Service xinetd Start/stop/status

4. Self-priming of the service

The Chkconfig command is primarily used to update (start or stop) and query run-level information for system services. Keep in mind that Chkconfig does not immediately automatically disable or activate a service, it simply changes the symbolic connection.

Use syntax: chkconfig [--add][--del][--list][system service] or Chkconfig [--level < rank code >][system service][on/off/reset]

Parameter usage:

--add adds the specified system service, allows the CHKCONFIG directive to manage it, and adds relevant data to the system-initiated narrative file.

--del deletes the specified system service, is no longer managed by the Chkconfig directive, and deletes the relevant data within the system-initiated narrative file.

--level< Class code > Specify which execution level the system service should be opened or closed. (You can see the previous operating level introduction)

It is necessary to note that the level option can specify the run levels to view and not necessarily the current run level. Right
At each run level, there can be only one startup script or stop script. When you switch the run level, Init does not
Restarts a service that is already started, and does not stop the service that has stopped.
Chkconfig--list [name]: Displays health status information for all run-level system services (on or
OFF). If name is specified, only the state of the specified service at a different run level is displayed.
Chkconfig--add Name: Add a new service. Chkconfig ensure that each run level has a
Start (S) or Kill (K) the entrance. If one is missing, it is automatically created from the default init script.
Chkconfig--del Name: Deletes the service and removes the associated symbolic connection from the/ETC/RC[0-6].D.
Chkconfig [--level levels] Name: Set a service at the specified run level is started, stop
or reset.
Examples of Use:
Chkconfig--list #列出所有的系统服务
Chkconfig--add httpd #增加 httpd Service
Chkconfig--del httpd #删除 httpd Service
Chkconfig--list #列出系统所有的服务启劢情况
Chkconfig--list mysqld #列出 mysqld Service Settings
Chkconfig--level mysqld on #设定 mysqld at level 3 and 5 for start-up service,-
-level 35 means that the operation is performed only at levels 3 and 5, on indicates start, and off indicates off
Chkconfig mysqld on #设定 mysqld is on at each level, "each level" includes 2, 3, 4, 5
Grade

Management of Linux Services

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.