久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      Linux下systemctl、service與chkconfig命令的區(qū)別詳解

      本篇文章給大家?guī)砹岁P(guān)于Linux的相關(guān)知識,其中主要介紹了systemctl和service、chkconfig命令的關(guān)系,以及區(qū)別介紹,下面一起來看一下,希望對大家有幫助。

      Linux下systemctl、service與chkconfig命令的區(qū)別詳解

      systemctl和service、chkconfig命令的關(guān)系

      • systemctl命令:是一個systemd工具,主要負責(zé)控制systemd系統(tǒng)和服務(wù)管理器。
      • service命令:可以啟動、停止、重新啟動和關(guān)閉系統(tǒng)服務(wù),還可以顯示所有系統(tǒng)服務(wù)的當(dāng)前狀態(tài)。
      • chkconfig命令:是管理系統(tǒng)服務(wù)(service)的命令行工具。所謂系統(tǒng)服務(wù)(service),就是隨系統(tǒng)啟動而啟動,隨系統(tǒng)關(guān)閉而關(guān)閉的程序。

      systemctl命令是系統(tǒng)服務(wù)管理器指令,它實際上將 service 和 chkconfig 這兩個命令組合到一起。

      systemctl是RHEL 7 的服務(wù)管理工具中主要的工具,它融合之前service和chkconfig的功能于一體??梢允褂盟谰眯曰蛑辉诋?dāng)前會話中啟用/禁用服務(wù)。

      所以systemctl命令是service命令和chkconfig命令的集合和代替。

      例如:使用service啟動服務(wù)實際上也是調(diào)用systemctl命令。

      [root@localhost ~]# service httpd start Redirecting to /bin/systemctl start  httpd.service
      登錄后復(fù)制

      登錄后復(fù)制

      systemctl命令的用法

      Systemctl命令簡介:

      Systemctl是一個systemd工具,主要負責(zé)控制systemd系統(tǒng)和服務(wù)管理器。

      Systemd是一個系統(tǒng)管理守護進程、工具和庫的集合,用于取代System V初始進程。Systemd的功能是用于集中管理和配置類UNIX系統(tǒng)。

      systemd即為system daemon,是linux下的一種init軟件。

      Systemctl命令常見用法:

      (1)列出所有可用單元:

      [root@localhost ~]# systemctl list-unit-files  UNIT FILE                                  STATE    proc-sys-fs-binfmt_misc.automount          static   dev-hugepages.mount                        static   dev-mqueue.mount                           static   proc-fs-nfsd.mount                         static   proc-sys-fs-binfmt_misc.mount              static   sys-fs-fuse-connections.mount              static   sys-kernel-config.mount                    static   sys-kernel-debug.mount                     static   tmp.mount                                  disabled var-lib-nfs-rpc_pipefs.mount               static   brandbot.path                              disabled cups.path                                  enabled
      登錄后復(fù)制

      (2)列出所有可用單元:

      [root@localhost ~]# systemctl list-units   UNIT                      LOAD      ACTIVE SUB       DESCRIPTION   proc-sys-fs-binfmt_misc.automount loaded    active waiting   Arbitrary    sys-devices-pci0000:00-0000:00:10.0-host2-target2:0:0-2:0:0:0-block-sda   sys-devices-pci0000:00-0000:00:10.0-host2-target2:0:0-2:0:0:0-block-sda   sys-devices-pci0000:00-0000:00:10.0-host2-target2:0:0-2:0:0:0-block-sda   sys-devices-pci0000:00-0000:00:10.0-host2-target2:0:1-2:0:1:0-block-sdb   sys-devices-pci0000:00-0000:00:10.0-host2-target2:0:1-2:0:1:0-block-sdb   sys-devices-pci0000:00-0000:00:11.0-0000:02:01.0-net-ens33.device loade   sys-devices-pci0000:00-0000:00:11.0-0000:02:02.0-sound-card0.device lo  ..............
      登錄后復(fù)制

      (3)列出所有失敗單元:

      [root@localhost ~]# systemctl --failed    UNIT                LOAD   ACTIVE SUB    DESCRIPTION ● network.service     loaded failed failed LSB: Bring up/down networking ● teamd@team0.service loaded failed failed Team Daemon for device team0  LOAD   = Reflects whether the unit definition was properly loaded. ACTIVE = The high-level unit activation state, i.e. generalization of SUB SUB    = The low-level unit activation state, values depend on unit type.  2 loaded units listed. Pass --all to see loaded but inactive units, too. To show all installed unit files use 'systemctl list-unit-files'.
      登錄后復(fù)制

      (4)檢查某個單元是否啟動:

      [root@localhost ~]# systemctl is-enabled httpd.service  enabled
      登錄后復(fù)制

      (5)檢查某個服務(wù)的運行狀態(tài):

      [root@localhost ~]# systemctl status httpd.service      ● httpd.service - The Apache HTTP Server    Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)    Active: active (running) since 日 2018-10-14 18:21:46 CST; 1 day 2h ago      Docs: man:httpd(8)            man:apachectl(8)  Main PID: 19020 (httpd)    Status: "Total requests: 0; Current requests/sec: 0; Current traffic:   0 B/sec"    CGroup: /system.slice/httpd.service            ├─19020 /usr/sbin/httpd -DFOREGROUND            ├─27310 /usr/sbin/httpd -DFOREGROUND            ├─27311 /usr/sbin/httpd -DFOREGROUND            ├─27312 /usr/sbin/httpd -DFOREGROUND            ├─27313 /usr/sbin/httpd -DFOREGROUND            └─27314 /usr/sbin/httpd -DFOREGROUND  10月 14 18:21:46 localhost systemd[1]: Starting The Apache HTTP Serv.... 10月 14 18:21:46 localhost httpd[19020]: AH00558: httpd: Could not r...e
      登錄后復(fù)制

      (6)列出所有服務(wù):

      [root@localhost ~]# systemctl list-unit-files --type=service UNIT FILE                                  STATE    abrt-ccpp.service                          enabled  abrt-oops.service                          enabled  abrt-pstoreoops.service                    disabled abrt-xorg.service                          enabled  abrtd.service                              enabled  accounts-daemon.service                    enabled  alsa-restore.service                       static   alsa-state.service                         static   alsa-store.service                         static   arp-ethers.service                         disabled atd.service                                disabled auditd.service                             enabled  auth-rpcgss-module.service                 static
      登錄后復(fù)制

      (7)啟動,停止,重啟服務(wù)等:

      [root@localhost ~]# systemctl restart httpd.service # systemctl restart httpd.service # systemctl stop httpd.service # systemctl reload httpd.service # systemctl status httpd.service
      登錄后復(fù)制

      (8)查詢服務(wù)是否激活,和配置是否開機啟動:

      [root@localhost ~]# systemctl is-active httpd active [root@localhost ~]# systemctl disable httpd Removed symlink /etc/systemd/system/multi-user.target.wants/httpd.service. [root@localhost ~]# systemctl enable httpd  Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
      登錄后復(fù)制

      (9)使用systemctl命令殺死服務(wù):

      [root@localhost ~]# systemctl kill httpd
      登錄后復(fù)制

      (10)列出系統(tǒng)的各項服務(wù),掛載,設(shè)備等:

      [root@localhost ~]# systemctl list-unit-files --type  automount  device     path       snapshot   swap       timer busname    mount      service    socket     target
      登錄后復(fù)制

      (11)獲得系統(tǒng)默認啟動級別和設(shè)置默認啟動級別:

      [root@localhost ~]# systemctl get-default  graphical.target [root@localhost ~]# systemctl set-default multi-user.target
      登錄后復(fù)制

      (12)啟動運行等級:

      systemctl isolate multiuser.target
      登錄后復(fù)制

      (13)重啟、停止,掛起、休眠系統(tǒng)等:

      # systemctl reboot # systemctl halt # systemctl suspend # systemctl hibernate # systemctl hybrid-sleep
      登錄后復(fù)制

      Service命令用法

      service命令可以啟動、停止、重新啟動和關(guān)閉系統(tǒng)服務(wù),還可以顯示所有系統(tǒng)服務(wù)的當(dāng)前狀態(tài)。

      service命令的作用是去/etc/init.d目錄下尋找相應(yīng)的服務(wù),進行開啟和關(guān)閉等操作。

      使用示例:

      開啟關(guān)閉一個服務(wù):service httpd start/stop

      [root@localhost ~]# service httpd start Redirecting to /bin/systemctl start  httpd.service
      登錄后復(fù)制

      登錄后復(fù)制

      查看系統(tǒng)服務(wù)的狀態(tài):service –status-all

      [root@localhost ~]# service --status-all 未加載 netconsole 模塊 已配置設(shè)備: lo ens33 ens33.old team0 team0-port1 team0-port1.old team0-port2 team0-port2.old team0.old 當(dāng)前活躍設(shè)備: lo ens33 virbr0 ens38 ens39 team0 ● rhnsd.service - LSB: Starts the Spacewalk Daemon    Loaded: loaded (/etc/rc.d/init.d/rhnsd; bad; vendor preset: disabled)    Active: active (running) since 五 2018-10-12 14:53:19 CST; 3 days ago      Docs: man:systemd-sysv-generator(8)  Main PID: 1380 (rhnsd)    CGroup: /system.slice/rhnsd.service            └─1380 rhnsd
      登錄后復(fù)制

      chkconfig命令用法

      chkconfig是管理系統(tǒng)服務(wù)(service)的命令行工具。所謂系統(tǒng)服務(wù)(service),就是隨系統(tǒng)啟動而啟動,隨系統(tǒng)關(guān)閉而關(guān)閉的程序。

      chkconfig可以更新(啟動或停止)和查詢系統(tǒng)服務(wù)(service)運行級信息。更簡單一點,chkconfig是一個用于維護/etc/rc[0-6].d目錄的命令行工具。

      chkconfig常見用法:

      [root@localhost ~]# chkconfig  --help chkconfig 版本 1.7.2 - 版權(quán) (C) 1997-2000 紅帽公司 在 GNU 公共許可條款下,本軟件可以自由重發(fā)行。  用法:   chkconfig [--list] [--type <類型>] [名稱]          chkconfig --add <名稱>          chkconfig --del <名稱>          chkconfig --override <名稱>          chkconfig [--level <級別>] [--type <類型>] <名稱> <on|off|reset|resetpriorities>
      登錄后復(fù)制

      (一)設(shè)置service開機是否啟動:

      chkconfig name on/off/reset
      登錄后復(fù)制

      • on、off、reset用于改變service的啟動信息。
      • on表示開啟,off表示關(guān)閉,reset表示重置。
      • 默認情況下,on和off開關(guān)只對運行級2,3,4,5有效,reset可以對所有運行級有效。

      [root@localhost ~]# chkconfig httpd on 注意:正在將請求轉(zhuǎn)發(fā)到“systemctl enable httpd.service”。
      登錄后復(fù)制

      在Redhat7上,運行chkconfig命令,都會被轉(zhuǎn)到systemcle命令上。

      (2)設(shè)置service運行級別:

      chkconfig --level levels
      登錄后復(fù)制

      該命令可以用來指定服務(wù)的運行級別,即指定運行級別2,3,4,5等。

      • 等級0表示:表示關(guān)機
      • 等級1表示:單用戶模式
      • 等級2表示:無網(wǎng)絡(luò)連接的多用戶命令行模式
      • 等級3表示:有網(wǎng)絡(luò)連接的多用戶命令行模式
      • 等級4表示:不可用
      • 等級5表示:帶圖形界面的多用戶模式
      • 等級6表示:重新啟動

      例如:

      [root@localhost ~]# chkconfig --level 5 httpd on 注意:正在將請求轉(zhuǎn)發(fā)到“systemctl enable httpd.service”
      登錄后復(fù)制

      (三)列出service啟動信息:

      # chkconfig --list [name]
      登錄后復(fù)制

      如果不指定name,會列出所有services的信息。

      每個service每個運行級別都會有一個啟動和停止腳本;當(dāng)切換運行級別時,init不會重啟已經(jīng)啟動的service,也不會重新停止已經(jīng)停止的service。

      例如:

      [root@localhost ~]# chkconfig --list  注意:該輸出結(jié)果只顯示 SysV 服務(wù),并不包含原生 systemd 服務(wù)。SysV 配置數(shù)據(jù)可能被原生 systemd 配置覆蓋。        如果您想列出 systemd 服務(wù),請執(zhí)行 'systemctl list-unit-files'。       欲查看對特定 target 啟用的服務(wù)請執(zhí)行       'systemctl list-dependencies [target]'。  netconsole      0:關(guān)    1:關(guān)    2:關(guān)    3:關(guān)    4:關(guān)    5:關(guān)    6:關(guān) network         0:關(guān)    1:關(guān)    2:開    3:開    4:開    5:開    6:關(guān) rhnsd           0:關(guān)    1:關(guān)    2:開    3:開    4:開    5:開    6:關(guān)
      登錄后復(fù)制

      總結(jié):service命令的功能基本都被systemct取代。直接使用systemctl命令即可。

      推薦學(xué)習(xí):《Linux視頻教程》

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號