我有自制服务。只需通过运行命令即可启动此服务
sudo stunnel
我需要这个命令在启动时运行,所以我创建了一个LaunchDaemon但它无法正常工作。这是launchd文件:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple$
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.stunnel.stunnelstartup.plist</string>
<key>ProgramArguments</key>
<array>
<string>/bin/sh</string>
<string>/usr/local/etc/stunnel/startup.sh</string>
</array>
<key>UserName</key>
<string>ROOT</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<false/>
</dict>
</plist>
这是shell脚本:
#!/bin/bash
#stunnel startup
sleep 30 #Delay added for the system to boot properly
sudo stunnel
我究竟做错了什么???
编辑:到目前为止,我已经完成了所有答案的建议,但仍然没有运气。这是我的新发布文件:
我还编辑了stunnel配置,因此它不在后台运行
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple$
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.stunnel.stunnelstartup.plist</string>
<key>Program</key>
<string>/usr/local/bin/stunnel</string>
<key>UserName</key>
<string>root</string>
<key>RunAtLoad</key>
<true/>
<key>AbandonProcessGroup</key>
<false/>
</dict>
</plist>
AbandonProcessGroup
钥匙倒了,应该是真的不是假的。我还添加了关于从脚本和stunnel捕获调试输出的建议