Linux有0-6共7个运行级别,现在的Linux发行版一般默认运行级别是5(图形界面多用户模式),另一个提倡使用的是运行级别3(字符界面多用户模式)。
1.查看Linux的运行级别:
[root@test ~]#runlevel
5 3
该命令将先后显示系统上一次和当前运行的级别。如果不存在上一次运行级别则用N表示。
2.chkconfig:管理系统服务默认开机启动与否
[root@test ~]chkconfig --list [服务名称]
[root@test ~]chkconfig [--level[0123456]][服务名称]
说明:
--list:将目前的各项服务状态栏显示出来
--level:设置某个服务在该level下启动(on)或是关闭(off)
例子1:列出目前系统上所有被chkconfig管理的服务
[root@test ~]# chkconfig --list
NetworkManager
acpid
anacron
atd
......................... 略 ............................
例子2:
[root@test ~]# chkconfig --list|grep '3:on'
autofs
avahi-daemon
bluetooth
......................... 略 ............................
例子3:设置mysqld在运行级别为3、4、5时启动
[root@test ~]# chkconfig --level 345