systemd
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*systemd [#i3afede8]
-Linuxのサービスを管理する仕組み
-CentOS7以降で導入された
*systemdの仕組み [#x484f2bf]
**ユニット [#r7cf2c06]
-サービスを管理する単位
-サービスを並列で起動することが可能
***ユニットのタイプ [#sc26a046]
-service
-target
-mount
-device
-socket
**ターゲット [#re1f7164]
-制御対象となる複数のサービスをグループ化する仕組み
-ユニットの起動する順番や依存関係を定義することが可能
*コマンド [#cab51536]
**systemctl [#if2cd13b]
-サービスの状態を確認
systemctl status <service-name> ※サービスの稼働状況を表示
systemctl is-active <service-name> ※サービスが稼働中か...
| 状態 | 説明 |h
| loaded | プロセスが起動している状態 |
| active(running) | プロセスが実行中 |
| active(exited) | プロセスの起動が終了 |
| active(waiting) | イベントの発生を待機中 |
| inactive | 起動していない |
| enabled | 自動起動がON |
| disabled | 自動起動がOFF |
-自動起動の設定
systemctl is-enabled <service-name> ※自動起動の設定を表示
systemctl enable <service-name> ※自動起動ON
systemctl disable <service-name> ※自動起動OFF
systemctl preset <service-name> ※自動起動ONまたはOFF(プ...
--自動起動が設定されているサービスの確認
ls -l /etc/systemd/system/multi-user.target.wants/
※自動起動を有効にするとここにサービスのシンボリックリン...
-サービスの起動/停止/再起動
systemctl start <service-name> ※起動
systemctl stop <service-name> ※停止
systemctl restart <service-name> ※再起動
systemctl reload <service-name> ※サービスの設定を再読み...
-Unitの状態を確認
systemctl list-dependencies ※Unitの依存関係を表示
systemctl list-dependencies <service-name> ※Unitの依存...
systemctl list-units ※起動している全てのUnitの状態を表示
systemctl list-unit-files ※全てのUnitを表示
systemctl list-unit-files -t service ※サービスの一覧を...
systemctl list-unit-files -t service --state=enabled ※...
-Unitのマスク(手動でも起動できないようにする)
systemctl mask <service-name> ※マスク有効
systemctl unmask <service-name> ※マスク解除
-システムの操作
systemctl poweroff ※システムを停止
systemctl reboot ※システムを再起動
-Unitファイルを再読み込み ※Unitファイルを追加・変更した...
systemctl daemon-reload
***ターゲット [#s39b1a3a]
-デフォルトのターゲットを表示
systemctl get-default
-デフォルトのターゲットを設定
systemctl set-default <target-name>
-ターゲットの切り替え
systemctl isolate rescue.target ※シングルユーザーモード
systemctl isolate multi-user.target ※マルチユーザーモード
systemctl isolate emergency.target ※緊急モード
**設定ファイル(ユニットファイル) [#h119d62b]
***/usr/lib/systemd/system/ [#h4e3af6b]
-標準のユニットファイル(通常はパッケージが提供) ※Red H...
-ユニットファイルを変更する場合、標準のユニットファイルを...
***/lib/systemd/system/ [#y9807c7c]
-標準のユニットファイル(通常はパッケージが提供) ※Debia...
***/etc/systemd/system/ [#t4d635c5]
-ユーザーが独自に定義したユニットファイル
-標準のユニットファイルより優先される
*補足 [#i5a6724c]
-起動するターゲットの確認
--/etc/systemd/system/default.target
ls -l /etc/systemd/system/default.target
→default.targetのリンク先で確認する
→multi-user.target であればマルチユーザ
-起動するターゲットの変更
--default.target のリンク先を変更する(lnコマンド)
*CUIツール [#sd69c4c4]
**ntsysv [#wc1aa170]
-インストール
dnf install ntsysv
-起動
ntsysv
*関連用語 [#y8e4920e]
-[[Linuxコマンド]]
-[[Linuxの起動・シャットダウン]]
-[[SysVinit]]
終了行:
*systemd [#i3afede8]
-Linuxのサービスを管理する仕組み
-CentOS7以降で導入された
*systemdの仕組み [#x484f2bf]
**ユニット [#r7cf2c06]
-サービスを管理する単位
-サービスを並列で起動することが可能
***ユニットのタイプ [#sc26a046]
-service
-target
-mount
-device
-socket
**ターゲット [#re1f7164]
-制御対象となる複数のサービスをグループ化する仕組み
-ユニットの起動する順番や依存関係を定義することが可能
*コマンド [#cab51536]
**systemctl [#if2cd13b]
-サービスの状態を確認
systemctl status <service-name> ※サービスの稼働状況を表示
systemctl is-active <service-name> ※サービスが稼働中か...
| 状態 | 説明 |h
| loaded | プロセスが起動している状態 |
| active(running) | プロセスが実行中 |
| active(exited) | プロセスの起動が終了 |
| active(waiting) | イベントの発生を待機中 |
| inactive | 起動していない |
| enabled | 自動起動がON |
| disabled | 自動起動がOFF |
-自動起動の設定
systemctl is-enabled <service-name> ※自動起動の設定を表示
systemctl enable <service-name> ※自動起動ON
systemctl disable <service-name> ※自動起動OFF
systemctl preset <service-name> ※自動起動ONまたはOFF(プ...
--自動起動が設定されているサービスの確認
ls -l /etc/systemd/system/multi-user.target.wants/
※自動起動を有効にするとここにサービスのシンボリックリン...
-サービスの起動/停止/再起動
systemctl start <service-name> ※起動
systemctl stop <service-name> ※停止
systemctl restart <service-name> ※再起動
systemctl reload <service-name> ※サービスの設定を再読み...
-Unitの状態を確認
systemctl list-dependencies ※Unitの依存関係を表示
systemctl list-dependencies <service-name> ※Unitの依存...
systemctl list-units ※起動している全てのUnitの状態を表示
systemctl list-unit-files ※全てのUnitを表示
systemctl list-unit-files -t service ※サービスの一覧を...
systemctl list-unit-files -t service --state=enabled ※...
-Unitのマスク(手動でも起動できないようにする)
systemctl mask <service-name> ※マスク有効
systemctl unmask <service-name> ※マスク解除
-システムの操作
systemctl poweroff ※システムを停止
systemctl reboot ※システムを再起動
-Unitファイルを再読み込み ※Unitファイルを追加・変更した...
systemctl daemon-reload
***ターゲット [#s39b1a3a]
-デフォルトのターゲットを表示
systemctl get-default
-デフォルトのターゲットを設定
systemctl set-default <target-name>
-ターゲットの切り替え
systemctl isolate rescue.target ※シングルユーザーモード
systemctl isolate multi-user.target ※マルチユーザーモード
systemctl isolate emergency.target ※緊急モード
**設定ファイル(ユニットファイル) [#h119d62b]
***/usr/lib/systemd/system/ [#h4e3af6b]
-標準のユニットファイル(通常はパッケージが提供) ※Red H...
-ユニットファイルを変更する場合、標準のユニットファイルを...
***/lib/systemd/system/ [#y9807c7c]
-標準のユニットファイル(通常はパッケージが提供) ※Debia...
***/etc/systemd/system/ [#t4d635c5]
-ユーザーが独自に定義したユニットファイル
-標準のユニットファイルより優先される
*補足 [#i5a6724c]
-起動するターゲットの確認
--/etc/systemd/system/default.target
ls -l /etc/systemd/system/default.target
→default.targetのリンク先で確認する
→multi-user.target であればマルチユーザ
-起動するターゲットの変更
--default.target のリンク先を変更する(lnコマンド)
*CUIツール [#sd69c4c4]
**ntsysv [#wc1aa170]
-インストール
dnf install ntsysv
-起動
ntsysv
*関連用語 [#y8e4920e]
-[[Linuxコマンド]]
-[[Linuxの起動・シャットダウン]]
-[[SysVinit]]
ページ名: