Linux service process management
Service management
Process management
Preparation-install nginx service
Prepare to install an nginx web server, the default port is 80. For testing purposes
yum -y install nginx
Service Management-systemctl
7 : systemctl 6: service
Start: systemctl start nginx
Stop: systemctl stop nginx
Restart: systemctl restart nginx
Reload: systemctl reload nginx
Status: systemctl status nginx
Boot from boot: systemctl enable nginx
Boot prohibition: systemctl disable nginx
Service verification
netstat view port, tcp: -anlpt, udp: -anlpu
[root@myserver ~]# netstat -anlpt | grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 6416/nginx: master
tcp6 0 0 :::80 :::* LISTEN 6416/nginx: master
Process management
ps view process status
[root@myserver ~]# ps aux |grep nginx
root 6416 0.0 0.5 118672 9920? Ss 09:10 0:00 nginx: master process /usr/sbin/nginx
nginx 6447 0.0 0.4 150020 9000? S 09:10 0:00 nginx: worker process
root 6635 0.0 0.0 12108 1088 pts/0 S+ 09:15 0:00 grep --color=auto nginx
###
Running user, process id
kill to stop the process, kill pid, -9 to force a stop -15 to send a signal to stop steadily
kill pid
kill -9 123
kill -15 123
killall nginx ## Stop all processes of nginx service
top view system processes