Topic: OS X launchd script for task.php
In the install documentation, it requires adding a cron item for running testrail background tasks.
The OS X replacement for cron (though cron is still available as of 10.6) is launchd. So I wrote the plist for the process that runs the task.php background tasks script every 60 seconds. Of course you'll have to adjust both your path to php and your path to the task.php script.
<?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.gurock.testrail.tasks</string>
<key>ProgramArguments</key>
<array>
<string>/opt/local/bin/php</string>
<string>/opt/www/testrail/task.php</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StartInterval</key>
<integer>60</integer>
<key>UserName</key>
<string>_www</string>
</dict>
</plist>Name the file:
com.gurock.testrail.tasksand place in your LaunchDaemons folder:
sudo mv com.gurock.testrail.tasks /Library/LaunchDaemons/Then run it:
sudo launchctl load /Library/LaunchDaemons/com.gurock.testrail.tasksNow your system will run the task script every 60 seconds!
To stop it from running, use:
sudo launchctl unload /Library/LaunchDaemons/com.gurock.testrail.tasksIf you make any edits to the plist file (such as changing the execution interval), you will have to unload and load the script to see the results.
