Centos 6
1. 常用命令
service 服务名 start | stop | restart | reload | status
例:查看网卡状态: service network status
2. 设置自启动
-
查看服务是否自启
chkconfig --list | grep 服务名
-
设置自启动 ( on – 开启, off – 关闭)
chkconfig --level 5 服务名 on
Centos 7
1. 常用命令
sysremctl start | stop | restart | reload | status 服务名
例:查看防火墙状态: systemctl status firewall
2. 查看服务
-
方法:
/usr/lib/systemd/system
-
命令:
systemctl list-unit-files
systemmctl --type service
3.设置服务自启动 (enable : 启动, disable: 关闭)
systemctl enable 服务名