Two ways systemctl Linux service and service management

  1. service command
    service command actually go /etc/init.d directory, to perform procedures

     ```
     # service命令启动redis脚本
     service redis start
     # 直接启动redis脚本
     /etc/init.d/redis start
     # 开机自启动
     update-rc.d redis defaults
     ```
     其中的脚本需要我们自己编写
  2. systemctl command
    systemd Linux system is the latest system initialization (init), the role is to improve the startup speed of the system, start the process as less as possible more complicated process started.
    systemd corresponding process management command is systemctl
    • systemctl command compatible with the service
      that is under systemctl will go to /etc/init.d directory, view, execution procedures

      systemctl redis start
      systemctl redis stop
      # 开机自启动
      systemctl enable redis
    • systemctl command to manage resources Unit systemd
      systemd of Unit placed in the directory / usr / lib / systemd / system (Centos) or / etc / systemd / system (Ubuntu )
      There are four main types of file .mount, .service, .target ,. wants

      • .mount file defines a mount point, [Mount] node disposed in the What, Where, Type three data items
      • .service file defines a service, divided into [Unit], [Service], [Install] three subsections
      • .target defines some basic components, file calls for .service
      • .wants document defines a set of files to be executed, each execution, file folders inside .wants will be executed

To be continued ,, ,,

Guess you like

Origin www.cnblogs.com/jjxhp/p/11374791.html