このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン 最新のリビジョン 両方とも次のリビジョン | ||
centos:systemctl [2020/05/28 15:07] y2sunlight [systemdの基礎知識] |
centos:systemctl [2020/06/01 21:07] y2sunlight [systemctlコマンド] |
||
---|---|---|---|
行 4: | 行 4: | ||
--- // | --- // | ||
- | [[centos: | + | [[centos: |
- | systemd は RHEL7CentOS7で使われているサービスを管理するデーモンです。'' | + | systemd は RHEL7/ |
また、systemctl に触れる機会は既存サービスのメンテナンスの時だけに限りません。自作のWebAPIを公開する時などもサービスを自作しなければならいので使っています。兎に角、CentOS7 になってから systemctl はよく使うようになりました。 | また、systemctl に触れる機会は既存サービスのメンテナンスの時だけに限りません。自作のWebAPIを公開する時などもサービスを自作しなければならいので使っています。兎に角、CentOS7 になってから systemctl はよく使うようになりました。 | ||
+ | 関連記事 | ||
+ | |||
+ | * [[centos: | ||
+ | * [[centos: | ||
+ | * systemctl --- サービスの操作 | ||
+ | * [[centos: | ||
+ | * [[centos: | ||
リンク | リンク | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
- | * [[https:// | ||
---- | ---- | ||
行 20: | 行 26: | ||
===== systemdの基礎知識 ===== | ===== systemdの基礎知識 ===== | ||
- | サービスは Unit という単位で作られ、以下のディレクトリーに保存されています。 | + | === Unit === |
+ | サービスは Unit という単位で作られ、以下のディレクトリーに保存されています。この Unit を定義しているのが unitファイルです。 | ||
- | * 記号なしリスト | + | * / |
- | * 記号なしリスト | + | * / |
- | > TODO: | + | ''/ |
\\ | \\ | ||
- | |||
===== systemctlのユースケース ===== | ===== systemctlのユースケース ===== | ||
- | {{fa> | + | === サービスの操作 === |
- | < | + | |
- | journalctl | + | 形式: '' |
- | journalctl | + | |
- | </ | + | * COMMAND |
+ | * UNIT--- ユニット名(以下の例では '' | ||
- | {{fa> | + | {{fa> |
< | < | ||
- | journalctl -e # 最新のログ | + | systemctl status sshd |
- | journalctl | + | systemctl is-enabled sshd |
</ | </ | ||
- | {{fa> | + | {{fa> |
< | < | ||
- | journalctl -k # カーネルログ | + | systemctl start sshd |
- | journalctl -b # ブートログ | + | systemctl stop sshd # 終了 |
+ | systemctl restart sshd # 再起動 | ||
</ | </ | ||
- | {{fa> | + | {{fa> |
< | < | ||
- | journalctl -p err | + | systemctl enable sshd # 有効化 |
- | journalctl -p warning | + | systemctl disable sshd # |
</ | </ | ||
- | {{fa> | + | === サービス一覧 === |
+ | |||
+ | {{fa> | ||
< | < | ||
- | journalctl | + | systemctl list-units --type=service |
- | journalctl | + | |
</ | </ | ||
- | {{fa> | + | {{fa> |
< | < | ||
- | journalctl | + | systemctl list-unit-files --type=service |
- | journalctl | + | |
- | journalctl --since=" | + | |
</ | </ | ||
\\ | \\ | ||