Linux运维教程-Linux服务进程管理

Linux服务进程管理

  • 服务管理

  • 进程管理


准备工作- 安装nginx服务

准备安装一个nginx 网站服务器,默认端口为80。用于测试目的

yum -y install nginx


服务管理-systemctl

7 : systemctl   6: service

启动 : systemctl start nginx

停止: systemctl stop nginx

重启: systemctl restart nginx

重载: systemctl reload nginx

状态 : systemctl status nginx

开机自启 :  systemctl enable nginx

开机禁止:  systemctl disable nginx


服务验证


netstat 查看端口,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  


进程管理

ps 查看进程状态

[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

###
运行用户、进程id

kill 停止进程, kill pid , -9 强制停止  -15  发送信号稳定停止

kill pid
kill -9 123
kill -15 123
killall nginx   ## 将nginx服务的所有进程停止

top查看系统进程


猜你喜欢

转载自blog.51cto.com/15127507/2656571