0
我几乎没有使用OS X中的守护进程的经验,但设法运行一次,每60秒反复运行一次php文件。它似乎运作良好,并且会一次运行几周而没有问题。然而,偶尔它会停止工作,因为我无法弄清楚。发生这种情况后,我的守护进程将不再列在launchctl列表中。如果我运行launchctl start,它将再次开始工作,没有任何问题。LaunchDaemon意外退出
我该如何解决这个看似随机关机的原因? php文件用于从在线API请求数据,并使用检索到的信息更新MySQL数据库。
这里是我的plist文件的内容:
<?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>mschirma.automator</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/php</string>
<string>/Library/WebServer/Documents/automator/time_log.php</string>
</array>
<key>StartInterval</key>
<integer>60</integer>
</dict>
</plist>
感谢
谢谢!当它无法连接到远程API时,我的php脚本会超时,导致你描述的完全一样。 – 2014-09-13 00:14:37