1

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.tasks

and place in your LaunchDaemons folder:

sudo mv com.gurock.testrail.tasks /Library/LaunchDaemons/

Then run it:

sudo launchctl load /Library/LaunchDaemons/com.gurock.testrail.tasks

Now your system will run the task script every 60 seconds!

To stop it from running, use:

sudo launchctl unload /Library/LaunchDaemons/com.gurock.testrail.tasks

If 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.

2

Re: OS X launchd script for task.php

Hello Michael,

Thanks a lot for posting your task script/description file, I'm sure other customers will find this useful too (especially as we have more and more customers who run TestRail on OS X). I've updated our installation documentation with a pointer to this thread:

http://docs.gurock.com/testrail-admin/i … round_task

Thanks again!

Regards,
Dennis

Dennis Gurock,
Director & Co-Founder
Gurock Software