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

Linux大全评论338 views阅读模式

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就很好用了。)

[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         |                                                                               

                                                                               |                                |                                                                               

                                                                               |    +------+       +------+     |                                                                               

                                                                               |    | 确定 |       | 取消 |     |                                                                               

                                                                               |    +------+       +------+     |                                                                               

                                                                               |                                |                                                                               

                                                                               |                                |                                                                               

                                                                               +--------------------------------+                                                                               

                                                                                                                                                                                                

                                                                                                                                                                                                

企鹅博客
  • 本文由 发表于 2020年8月6日 11:26:18
  • 转载请务必保留本文链接:https://www.qieseo.com/209229.html

发表评论