以下の内容はhttps://iww.hateblo.jp/entry/20251015/journalctlより取得しました。


journalctlで、ソケットから起動されたサービスのログを見る

hoge.socket から起動された hoge@.service のログを見たい

journalctl -u "hoge@*.service" -f

hoge.socketから起動されたサービスは @ の後ろになんかいろいろ文字列がついて区別されるので、調べないとどれかよくわからない。
とにかく全部見たいときはワイルドカードで指定する。

# systemctl list-units "hoge@*" --all | cat
  UNIT                                                     LOAD   ACTIVE SUB     DESCRIPTION
* hoge@0-192.168.101.88:50101-192.168.101.89:49662.service loaded failed failed  Hoge Service Instance 0 (192.168.101.89:49662)
* hoge@1-192.168.101.88:50101-192.168.101.89:33148.service loaded failed failed  Hoge Service Instance 1 (192.168.101.89:33148)
* hoge@2-192.168.101.88:50101-192.168.101.89:59098.service loaded failed failed  Hoge Service Instance 2 (192.168.101.89:59098)
* hoge@3-192.168.101.88:50101-192.168.101.89:47724.service loaded failed failed  Hoge Service Instance 3 (192.168.101.89:47724)
* hoge@4-192.168.101.88:50101-192.168.101.89:54816.service loaded failed failed  Hoge Service Instance 4 (192.168.101.89:54816)
  hoge@5-192.168.101.88:50101-192.168.101.89:55398.service loaded active running Hoge Service Instance 5 (192.168.101.89:55398)

実際にはサービス名はこの hoge@5-192.168.101.88:50101-192.168.101.89:55398.service みたいな長ーいやつになってる

journalctl -u "hoge@5-192.168.101.88:50101-192.168.101.89:55398.service" -f

みたいに指定するので長い

逆にstopさせるときにもワイルドカードは使える。 やったぜ

systemctl stop hoge@*.service



以上の内容はhttps://iww.hateblo.jp/entry/20251015/journalctlより取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14