我有一个命令行应用程序,需要在用户登录时运行。我已将XML文件添加到用户的启动代理程序目录中。应用程序运行但问题是它在运行时打开终端。我希望它只是在后台运行而用户不知道它。这是我的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>LaunchOnlyOnce</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/open</string>
<string>-n</string>
<string>/Applications/Host</string>
</array>
<key>KeepAlive</key>
<false/>
<key>Label</key>
<string>com.test.httphost</string>
<key>RunAtLoad</key>
<true/>
</dict>
我该怎么做?
答案 0 :(得分:1)
我希望问题是调用open
。如果直接调用 / Applications / Host ,它应该按预期工作。
但是,如果您需要-n
param进行打开,请尝试通过调用带有/bin/bash
参数的-c
来调用它,并将其余命令传递给bash with a字符串。