monitを使用してシステム単位を確認する

monitを使用してシステム単位を確認する

ユーザーの名前空間の下にsystemdユニットがあるプログラムを確認する必要があります。ここに私のmonit confがあります(systemd confは問題なく動作します)。

check program foo with path "/usr/bin/systemctl --user -q is-active foo" as uid pioz and gid pioz
  start program = "/usr/bin/systemctl --user start foo" as uid pioz and gid pioz
  stop program = "/usr/bin/systemctl --user stop foo" as uid pioz and gid pioz
  if status != 0 then restart
  if 5 restarts within 5 cycles then timeout

このconfはエラーが発生したため機能しませんFailed to connect to bus: No such file or directory。 followコマンドを実行すると同じエラーが発生するため、コマンドが機能しないようsudo /usr/bin/systemctl --user -q is-active fooです。as uid pioz and gid piozこのように設定を変更すると、すべてがうまく機能します。

check program foo with path "/bin/su -c '/usr/bin/systemctl --user -q is-active foo' pioz"
  start program = "/bin/su -c '/usr/bin/systemctl --user start foo' pioz"
  stop program = "/bin/su -c '/usr/bin/systemctl --user stop foo' pioz"
  if status != 0 then restart
  if 5 restarts within 5 cycles then timeout

as uidなぜ動作しないのかご存知ですか?

ベストアンサー1

おすすめ記事