当我运行
brew services start mosquitto
时,服务未启动。当我使用 brew services list
时,服务具有黄色 started
状态。我想知道为什么这个服务启动失败,怎么办?
通常的日志最终会出现在
/usr/local/var/log/
。
当您看到brew服务的“已启动”为黄色时,意味着该服务的状态为“未知”,将打印已启动的文本以实现复古兼容性。
在您的情况下,我建议将一些日志输出添加到您的 .plist 关联文件中,要编辑正确的 plist 文件,请检查 mosquitto 行上“brew services list”命令的输出,您将获得相应的 .plist 文件的名称,编辑该文件并添加两个条目,我打印用于 apache 安装的 plist 文件,请使用此文件作为指南。检查 StandardOutPath 和 StandardErrorPath 行,并为您的具体情况创建类似的内容。
保存文件后尝试再次运行该服务,但这次检查关联的日志。 根据我的经验,当您看到黄色启动时,这意味着您遇到了一些权限问题,您可以尝试保存关联的数据并重新安装冲泡公式作为第二个选项。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>homebrew.mxcl.httpd</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/opt/httpd/bin/httpd</string>
<string>-D</string>
<string>FOREGROUND</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardOutPath</key>
<string>/usr/local/var/log/hombebrew/httpd/homebrew.mxcl.httpd.log</string>
<key>StandardErrorPath</key>
<string>/usr/local/var/log/hombebrew/httpd/homebrew.mxcl.httpd.stderr.log</string>
</dict>
</plist>
这个答案来自@AlexV 的评论,但在我看来它值得拥有自己的答案。
日志可以在以下位置找到:
/opt/homebrew/var/log
在 M1 或 M2 ARM 芯片上。