Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何监视 JournalD 中某些特定进程的错误/致命错误消息并启动一些回调(如果有)。假设某些服务 - 比如说 Nginx 发布带有错误的日志 - 一些脚本会调用。如何制作这样的脚本?
您必须使用journalctl --unit darts-game-server.service --follow -o json流并解析代码中的输出。也有用于此的库。
journalctl --unit darts-game-server.service --follow -o json