【linux】CentOS7的系统服务(systemctl)

通过systemctl命令执行对系统服务的操作

systemctl [OPTIONS...] COMMAND [NAME...]
例如启动网络服务
systemctl start NetworkManager
CentOS7有两个网络服务,其中network是为了兼容之前的版本,可以关掉network,只启动NetworkManager

systemctl stop network
systemctl restart NetworkManager
设置服务的开机自启动

设置自启动

systemctl enable NetworkManager

取消自启动

systemctl disable NetworkManager

查看服务的自启动情况,enable/disable/static,static依赖于其他服务的服务,本身不考虑是否自启动

systemctl list-unit-files
[root@linux ~]# systemctl list-unit-files
UNIT FILE                                     STATE   
proc-sys-fs-binfmt_misc.automount             static  
dev-hugepages.mount                           static  
dev-mqueue.mount                              static  
proc-fs-nfsd.mount                            static  
proc-sys-fs-binfmt_misc.mount                 static  
run-vmblock\x2dfuse.mount                     disabled
sys-fs-fuse-connections.mount                 static  
sys-kernel-config.mount                       static  
sys-kernel-debug.mount                        static  
tmp.mount                                     disabled
var-lib-nfs-rpc_pipefs.mount                  static  
brandbot.path                                 disabled
cups.path                                     enabled 
systemd-ask-password-console.path             static  

防火墙服务是firewalld,可用上面的命令进行停止/启动/重启/设置自启动/取消自启动

`

你可能感兴趣的:(【linux】CentOS7的系统服务(systemctl))