page counter next up previous contents
Next: 服務啟動 Up: systemctl 系統服務控制 Previous: 前言   Contents

systemctl 命令

  1. systemctl 命令用來管理各種不同型態的 systemd 物件。
    [root@kvm7 ~]# systemctl -t help
    Available unit types:
    service
    socket
    target
    device
    mount
    automount
    snapshot
    timer
    swap
    path
    slice
    scope
    
  2. systemctl 輔助說明
    [root@kvm7 ~]# systemctl --help
    systemctl [OPTIONS...] {COMMAND} ...
    
    Query or send control commands to the systemd manager.
    
      -h --help           Show this help
         --version        Show package version
      -t --type=TYPE      List only units of a particular type
         --state=STATE    List only units with particular LOAD or SUB or ACTIVE stat
      -p --property=NAME  Show only properties by this name
      -a --all            Show all loaded units/properties, including dead/empty
                          ones. To list all units installed on the system, use
                          the 'list-unit-files' command instead.
         --reverse        Show reverse dependencies with 'list-dependencies'
      -l --full           Don't ellipsize unit names on output
         --fail           When queueing a new job, fail if conflicting jobs are
                          pending
         --irreversible   When queueing a new job, make sure it cannot be implicitly
                          cancelled
         --ignore-dependencies
                          When queueing a new job, ignore all its dependencies
         --show-types     When showing sockets, explicitly show their type
      -i --ignore-inhibitors
                          When shutting down or sleeping, ignore inhibitors
         --kill-who=WHO   Who to send signal to
      -s --signal=SIGNAL  Which signal to send
      -H --host=[USER@]HOST
                          Show information for remote host
      -P --privileged     Acquire privileges before execution
      -q --quiet          Suppress output
         --no-block       Do not wait until operation finished
         --no-wall        Don't send wall message before halt/power-off/reboot
         --no-reload      When enabling/disabling unit files, don't reload daemon
                          configuration
         --no-legend      Do not print a legend (column headers and hints)
         --no-pager       Do not pipe output into a pager
         --no-ask-password
                          Do not ask for system passwords
         --system         Connect to system manager
         --user           Connect to user service manager
         --global         Enable/disable unit files globally
         --runtime        Enable unit files only temporarily until next reboot
      -f --force          When enabling unit files, override existing symlinks
                          When shutting down, execute action immediately
         --root=PATH      Enable unit files in the specified root directory
      -n --lines=INTEGER  Number of journal entries to show
      -o --output=STRING  Change journal output mode (short, short-monotonic,
                          verbose, export, json, json-pretty, json-sse, cat)
         --plain          Print unit dependencies as a list instead of a tree
    
    Unit Commands:
      list-units                      List loaded units
      list-sockets                    List loaded sockets ordered by address
      start [NAME...]                 Start (activate) one or more units
      stop [NAME...]                  Stop (deactivate) one or more units
      reload [NAME...]                Reload one or more units
      restart [NAME...]               Start or restart one or more units
      try-restart [NAME...]           Restart one or more units if active
      reload-or-restart [NAME...]     Reload one or more units if possible,
                                      otherwise start or restart
      reload-or-try-restart [NAME...] Reload one or more units if possible,
                                      otherwise restart if active
      isolate [NAME]                  Start one unit and stop all others
      kill [NAME...]                  Send signal to processes of a unit
      is-active [NAME...]             Check whether units are active
      is-failed [NAME...]             Check whether units are failed
      status [NAME...|PID...]         Show runtime status of one or more units
      show [NAME...|JOB...]           Show properties of one or more
                                      units/jobs or the manager
      set-property [NAME] [ASSIGNMENT...]
                                      Sets one or more properties of a unit
      help [NAME...|PID...]           Show manual for one or more units
      reset-failed [NAME...]          Reset failed state for all, one, or more
                                      units
      list-dependencies [NAME]        Recursively show units which are required
                                      or wanted by this unit or by which this
                                      unit is required or wanted
    
    Unit File Commands:
      list-unit-files                 List installed unit files
      enable [NAME...]                Enable one or more unit files
      disable [NAME...]               Disable one or more unit files
      reenable [NAME...]              Reenable one or more unit files
      preset [NAME...]                Enable/disable one or more unit files
                                      based on preset configuration
      is-enabled [NAME...]            Check whether unit files are enabled
    
      mask [NAME...]                  Mask one or more units
      unmask [NAME...]                Unmask one or more units
      link [PATH...]                  Link one or more units files into
                                      the search path
      get-default                     Get the name of the default target
      set-default NAME                Set the default target
    
    Job Commands:
      list-jobs                       List jobs
      cancel [JOB...]                 Cancel all, one, or more jobs
    
    Snapshot Commands:
      snapshot [NAME]                 Create a snapshot
      delete [NAME...]                Remove one or more snapshots
    
    Environment Commands:
      show-environment                Dump environment
      set-environment [NAME=VALUE...] Set one or more environment variables
      unset-environment [NAME...]     Unset one or more environment variables
    
    Manager Lifecycle Commands:
      daemon-reload                   Reload systemd manager configuration
      daemon-reload                   Reload systemd manager configuration
      daemon-reexec                   Reexecute systemd manager
    
    System Commands:
      default                         Enter system default mode
      rescue                          Enter system rescue mode
      emergency                       Enter system emergency mode
      halt                            Shut down and halt the system
      poweroff                        Shut down and power-off the system
      reboot                          Shut down and reboot the system
      kexec                           Shut down and reboot the system with kexec
      exit                            Request user instance exit
      switch-root [ROOT] [INIT]       Change to a different root file system
      suspend                         Suspend the system
      hibernate                       Hibernate the system
      hybrid-sleep                    Hibernate and suspend the system
    



2015-12-04