如需学习视频,请在微信搜索公众年夜众号“智传网优”直接开始自助视频学习
本文紧张是讲解service命令的功能与日常利用方法,该命令是红帽兼容系列的发行版中用来掌握系统做事的实用工具,它以启动、停滞、重新启动和关闭系统做事,还可以显示所有系统做事确当前状态。把稳CentOS7往后利用了systemctl工具来管理做事,不再利用service。
以下命令不适用于CentOS7
2. 常用办法
2.1 启动做事
service <service> start
2.2 停滞做事
service <service> stop
2.3 重启做事
service <service> restart
事理是先停滞再启动
3. 查看网络做事的状态
[root@zcwyou ~]# service network status
Configured devices:
lo eth0
Currently active devices:
lo eth0
Linux利用service命令查看某做事的状态
4. 重启网络做事
[root@zcwyou ~]# service network restart
Shutting down interface eth0: Device state: 3 (disconnected)
[ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: Active connection state: activating
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/1
state: activated
Connection activated
[ OK ]
Linux重启某做事
5. 停滞网络做事
[root@zcwyou ~]# service network stop
Shutting down interface eth0: Device state: 3 (disconnected)
[ OK ]
Shutting down loopback interface: [ OK ]
Linux停滞某做事
6. 启动网络做事
[root@zcwyou ~]# service network start
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: Active connection state: activating
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/1
state: activated
Connection activated
Linux利用service命令启动做事
7. 重启mysql做事
[root@zcwyou ~] service mysqld restart
stopping MySQL: [ OK ]
starting MySQL: [ OK ]
8.总结
Service命令用于管理程序的运行,该命令只适用CentOS6及更老的版本,CentOS7不建议利用该命令。
本文已同步至博客站:
https://www.linuxrumen.com/cyml/449.html
点击理解更多,快速查看更多的技能文章列表。