Linux下面开起启动服务命令(chkconfig、ntsysv)

netstat可用查看目前已经启动的服务,service可以用来立即启动某个服务。chkconfig用来设置服务在开机的时候自动启动。

--查看nfs服务是否开机自动启动。可以看见6个开机级别都不会启动nfs服务。
[root@db ~]# chkconfig  --list nfs
nfs             0:off   1:off   2:off   3:off   4:off   5:off   6:off

--设置开机自动启动nfs服务。
[root@db ~]# chkconfig  nfs on

--再次查看,可以看见2、3、4、5级别开机会自动启动nfs服务。
[root@db ~]# chkconfig  --list nfs
nfs             0:off   1:off   2:on    3:on    4:on    5:on    6:off

--取消开机自动启动nfs服务。
[root@db ~]# chkconfig nfs off

--再次查看,6个级别开机又都不会启动nfs服务了。
[root@db ~]# chkconfig  --list nfs
nfs             0:off   1:off   2:off   3:off   4:off   5:off   6:off

--设置3级别开机自动启动nfs服务。
[root@db ~]# chkconfig --level 3 nfs on

--再次查看,可以看见在级别开机会自动启动nfs服务。
[root@db ~]# chkconfig --list nfs
nfs             0:off   1:off   2:off   3:on    4:off   5:off   6:off

-------------------------------------------------------------------------------------------------------------------------

ntsysv:类图形界面管理模式来设置开机启动。(RedHat特有的,基本上chkconfig就很好用了。)

总结一下功能按钮:
上下键:可以在中间的方框当中,在各个服务之间移动;
空格键:可以用来选择你所需要的服务,[*]表示开起启动;
tab键:可以在方框、OK、Cancel之间移动;
[F1]键:可以显示该服务的说明。      
例如:

[root@linux ~]# ntsysv
ntsysv 1.3.30.1 - (C) 2000-2001 Red Hat, Inc.                                                                                                                                                   
                                                                                                                                                                                                
                                                                                                                                                                                                
                                                                               +------------+ 服务 +------------+                                                                               
                                                                               |                                |                                                                               
                                                                               | 您想自动启动哪些服务?         |                                                                               
                                                                               |                                |                                                                               
                                                                               |     [ ] NetworkManager         |                                                                               
                                                                               |     [*] acpid                  |                                                                               
                                                                               |     [ ] amanda           a     |                                                                               
                                                                               |     [ ] amd              a     |                                                                               
                                                                               |     [*] anacron          a     |                                                                               
                                                                               |     [*] apmd             a     |                                                                               
                                                                               |     [*] arptables_jf     a     |                                                                               
                                                                               |     [ ] arpwatch         a     |                                                                               
                                                                               |     [*] atd              a     |                                                                               
                                                                               |     [*] auditd           a     |                                                                               
                                                                               |     [ ] auth             a     |                                                                               
                                                                               |     [*] autofs           a     |                                                                               
                                                                               |     [*] avahi-daemon     a     |                                                                               
                                                                               |     [ ] avahi-dnsconfd   a     |                                                                               
                                                                               |     [*] bluetooth        a     |                                                                               
                                                                               |     [ ] capi             a     |                                                                               
                                                                               |     [ ] chargen-dgram    a     |                                                                               
                                                                               |     [ ] chargen-stream   a     |                                                                               
                                                                               |     [ ] conman           a     |                                                                               
                                                                               |     [*] cpuspeed         a     |                                                                               
                                                                               |     [*] crond            a     |                                                                               
                                                                               |     [*] cups             a     |                                                                               
                                                                               |     [ ] cvs              a     |                                                                               
                                                                               |     [ ] daytime-dgram    a     |                                                                               
                                                                               |     [ ] daytime-stream         |                                                                               
                                                                               |                                |                                                                               
                                                                               |    +------+       +------+     |                                                                               
                                                                               |    | 确定 |       | 取消 |     |                                                                               
                                                                               |    +------+       +------+     |                                                                               
                                                                               |                                |                                                                               
                                                                               |                                |                                                                               
                                                                               +--------------------------------+                                                                               
                                                                                                                                                                                                
                                                                                                                                                                                                

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/23083.html