It's possible I can't use launchd for this, I just couldn't find anything saying explicitly NO. So, here's the question...
I'd like to run my Watir scripts 10 minutes past the hour, every hour. This script launches Firefox, performs tests, and logs results to standard output. I setup my plist file like this:
<?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>client_checkout</string>
<key>Program</key>
<string>/Users/chris/svn/qa/watir/tests/client.sh</string>
<key>StartCalendarInterval</key>
<dict>
<key>Minute</key>
<integer>52</integer>
</dict>
</dict>
</plist>
Inside that shell script I have:
echo 'hello' >> /Users/chris/results.txt
ruby /Users/chris/svn/qa/watir/tests/client_checkout.rb
The echo is there for debug purposes.
When I place the plist file in /Library/LaunchDaemons the script runs and I see 'Hello' written to the text file. Then, it fails when it hits the Ruby part. When I look at system.log I see:
com.apple.launchd.peruser.502[118] (client_checkout[25285]): Exited with code: 1
I tried switching the plist file over to /Library/LaunchAgents but it's the same exact results.
Also, I don't think it's a file path problem. When I provide the full file path, as I'm doing here, these scripts run fine from any directory.
Can I not use launchd this way? Am I "doing it wrong"? What's going on? Thank you!