Home > Operation and Maintenance > Linux Operation and Maintenance > How to check service status in linux

How to check service status in linux

王林
Release: 2019-12-03 13:38:00
Original
22419 people have browsed it

How to check service status in linux

1. Use the process to check

Use the command:

ps -aux | grep xxx
Copy after login

to check whether a process or service exists.

Online video tutorial sharing: linux video tutorial

2. Use the services command

1. View the operation of a single service Status:

service 服务名 status
Copy after login

Such as:

[root@localhost ~]# service sshd status 
openssh-daemon (pid 3701) 正在运行…
Copy after login

2. View the running status of all services:

service –status -all
Copy after login

3. Use the chkconfig configuration tool

(There is no chkconfig command in Ubuntu, you can use update-rc.d instead. The update-rc.d command in Ubuntu or Debian systems is a script used to update system startup items. The links to these scripts are located in / etc/rcN.d/ directory, and the corresponding script is located in the /etc/init.d/ directory. Before understanding the update-rc.d command, what you need to know is the main startup steps of the Linux system and the knowledge of the run level in Ubuntu. )

1. Check the running status of a single service:

chkconfig 服务名 status
Copy after login

2. Check the running status of all services

chkconfig –list
Copy after login

3. Close or start the service Status:

chkconfig –level 345 nscd off/on
Copy after login

4. Add service:

chkconfig –add xxx
Copy after login

(Note: The service script must be stored in the /etc/init.d/ directory)

For example, mysqld:

[root@www mysql-5.1.59]#cp support-files/mysql.server etc/init.d/mysqld 
chkconfig mysqld on
Copy after login

(each level is ON, each level is 2345 level) This will start as a system service.

5. Delete service:

chkconfig –del XXX
Copy after login

runlevel Check the current level.

Note: The run level is the functional level at which the operating system is running.

Recommended related articles and tutorials: linux tutorial

The above is the detailed content of How to check service status in linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template