systemd
#Linux
System and Service Manager
systemd - ArchWiki
systemd のユニットファイルの作り方 | 晴耕雨読
systemdでプロセス自動再起動 | 晴耕雨読
サーバーの再起動後に Linux オペレーティング・システム上のポートにバインドできない - IBM Documentation
続くといいな日記 – Systemd ユニットのセキュリティスコアを改善する
service start-limit-hit エラーが出る場合
systemd の定義自体が間違っていることが原因で起動に失敗し、再起動を繰り返し limit に到達している場合がある
Unit ファイル(設定ファイル)の書き方
systemd - ArchWiki
unit file の配置場所
Unit ファイルに記述されているディレクティブの意味を調べる場合は systemd.directives を検索すればよい
編集するには systemctl edit --full が便利
systemd.exec
Except in case of ConfigurationDirectory=, the innermost specified directories will be owned by the user and group specified in User= and Group=.
symlink を使う方法
systemd.directives
jourcalctl
ファイルにリダイレクトできる
$ journalctl > log.txt
最低限知っておきたいsystemctlとjournalctlの使い方 - karakaram-blog
最新から読むには -r
特定のサービスのログ
--unit, -u
/kuuote/systemd-nspawn
start request repeated too quickly
systemd の "start request repeated too quickly for ~" というログ
RestartMaxDelaySec とか RestartSec が使えそう
systemd.service
Nix
nix 独自のディレクティブがある。 script とか。
NixOS Search - Options - script
その他
NixOS Search - Options - systemd.services
preStart でディレクトリを作ろうとすると権限がない
一時ファイルなら systemd-tmpfiles で管理するのが良さそう
StateDirectory を指定すれば事前に作ってくれる
systemd.exec
ReadWritePaths?
依存関係
requires
systemd.unit
指定した unit も起動される
順序関係は指定されない
requiredBy は依存される側から同じ指定をするだけ
systemd.unit
before, after
systemd.unit