1. Use the process to check
Use the command:
ps -aux | grep xxx
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
Such as:
[root@localhost ~]# service sshd status openssh-daemon (pid 3701) 正在运行…
2. View the running status of all services:
service –status -all
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
2. Check the running status of all services
chkconfig –list
3. Close or start the service Status:
chkconfig –level 345 nscd off/on
4. Add service:
chkconfig –add xxx
(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
(each level is ON, each level is 2345 level) This will start as a system service.
5. Delete service:
chkconfig –del XXX
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!