Linux-共通命令05-systemd

2023 ワード

systemd
すなわちsystem deamonは、Linuxの下のinitソフトウェアであり、redhat、ubuntu、centosなど、ほとんどのオープンソースの異なるリリース版のlinuxがサポートしています.システムdは命令のセットであり、その中で最も主要なのはシステムctlコマンドである.
1.systemctlメインコマンド
1.1共通コマンド
Systemctlはsystemの主なコマンドであり、システムとサービスを管理する.
man systemctl systemctlヘルプドキュメントの表示
  • systemctl reboot再起動
  • systemctl poweroffシステムを閉じる、電源を切る
  • .
  • systemctl halt CPU停止動作
  • systemctl start httpd.service httpdサービス
  • を開始
  • systemctl stop httpd.service閉鎖サービス
  • systemctl restart httpd.serviceサービス再開
  • systemctl kill httpd.service httpサービス下のすべてのサブプロセス
  • を閉じる.
  • systemctl enable httpd.service起動httpd
  • systemctl disable httpd.service起動禁止httpd
  • サービスプロファイルの変更
  • systemctl daemon-reload再ロード構成
  • systemctl restart httpd.service再起動が有効になる

  • 1.2 unitの認知
    unitコンセプト:systemdはすべてのシステムリソースを管理できます.異なるリソースを総称してunit単位と呼ぶ
  • unitは全部で12種類に分けられます
  • serviceシステムサービス
  • target複数のunitからなる1つのグループ
  • deviceハードウェアデバイス
  • mountファイルシステムのマウントポイント
  • 自動マウントポイント
  • pathファイルまたはパス
  • scopeはsystemdによって開始された外部プロセス
  • ではない.
  • sliceプロセスグループ
  • snapshotスナップショット
  • socketプロセス間の通信のsocket
  • swap swapファイル
  • timerタイマ
  • unit関連コマンド
  • systemctl list-units実行中のunit
  • のリスト
  • systemctl list-units --type=serviceは、サービスとして実行中のすべてのサービス
  • をリストする.
  • systemctl list-units --allはすべてのunitをリストし、パッケージはプロファイルまたは起動に失敗した
  • を見つけませんでした.
  • systemctl list-units --failedは、すべてのロードに失敗したサービス
  • をリストする.
  • systemctl list-units --all --state=inactive実行されていないunit
  • がリストされます.

    2.systemd-analyze起動時間の表示
    3.ホスト情報の表示と設定
  • hostnamectl set-hostname [newhostname]ホスト名
  • を設定する.
    4.localectlローカライズ情報の表示と設定
    5.timedatectl現在のタイムゾーンの表示と設定
    6.loginctl現在のログインユーザーの表示