Service(centos6)
- 注册在系统中的标准化程序
- 有方便统一的管理方法(常用方法)
- service 服务名 start
- service 服务名 stop
- service 服务名 restart
- service 服务名 status
- 查看服务的方法 /etc/init.d/服务名
- 通过chkconfig 命令设置自启动
- 查看服务 chkconfig --list|grep xxx
- chkconfig --level 5 服务名 on
运行级别runlevel(centos6)
- 查看默认级别:vi /ect/inittab
- 7中运行级别:常用级别是3和5
- 0:系统停机状态,系统默认运行级别不能设为0.否则不能正常启动
- 1:单用户工作状态,root权限,用于系统维护,禁止原创登录
- 2:多用户状态(没有NFS),不支持网络
- 3:完全的多用户状态(有NFS)。登陆后进入控制台命令行模式
- 4:系统未使用,保留
- 5:X11控制台,登录后进入图形GUI模式
- 6:系统正常关闭并重启,默认运行级别不能设为6,否则不能正常启动
systemctl(centos7)
- 常用方法
- systemctl start 服务名
- systemctl restart 服务名
- systemctl stop 服务名
- systemctl reload 服务名
- systemctl status 服务名
- 查看服务命令
- systemctl list-unit-files
- systemctl --type service
- systemctl list-unit-files |grep 服务名 查找服务
- 通过systemctl命令设置自启动
- 自启动systemctl enable service_name
- 不自启动 systemctl disable service_name