我试图弄清楚为什么我的守护进程没有自动启动(在 Mac 10.8.3 上)。但是,它在其他机器上运行良好。这是我在/Library/LaunchDaemons/下的 plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.MyApp.tmsm.launcher</string>
<key>ProgramArguments</key>
<array>
<string>/Library/Application Support/MyApp/tmsmLauncher</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<false/>
<key>StartInterval</key>
<integer>60</integer>
</dict>
</plist>
我在
/var/log/system.log
中没有看到任何错误消息.我查了 permission
和 owner
我的 daemon
.如果我把我的 plist 放在 /System/Library/LaunchDaemons/
下,可以在reboot
之后启动.但这对我来说不是一个好的解决方案。如果我使用“launchctl load /Library/LaunchDaemons/com.MyApp.tmsm.launcher
”,它运行良好。如果我安装了其他商业软件,它是一个守护进程并且在 /Library/LaunchDaemons/
下有一个 plist ,它也无法启动。在
/Library/LaunchDaemons/
下似乎有任何 plist没有被系统加载。我还尝试使用命令“launchctl log level debug
”打开 launchctl 调试级别,但重新启动后没有更多消息。重启后调试级别是否重置?我可以检查其他日志或配置吗?谢谢。
最佳答案
尝试使用 -w 参数加载它:sudo launchctl load -w /Library/LaunchDaemons/blablabla.plist
.看起来像禁用键中的问题。见 man launchctl
详情。
如果这不起作用,我建议您在守护程序中启用一些日志记录以查看它是否启动(可能只是立即退出?)
关于macos - launchd 不启动我的守护进程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16809861/