[launchd-dev] Environment variable usage in LaunchAgents plist files
Levi Brown
levi at grokers.net
Tue Mar 4 14:24:52 PST 2008
Hi All,
While trying to understand why my console had log entries every two
minutes such as this:
3/4/08 10:40:00 com.apple.launchd[1] (0x102450.cron[9834]) Could not
setup Mach task special port 9: (os/kern) no access
I decided that perhaps it was time to get rid of my cron jobs in favor
of launchd.plist entries. So I set out to convert my crontab entry:
*/2 * * * * /bin/sh "${HOME}/Library/Automation/checkmail.sh" > /dev/
null 2>&1
into a launchd.plist of equal functionality. I presently have:
<?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.lab.checkmail</string>
<key>ProgramArguments</key>
<array>
<string>/bin/sh</string>
<string>/Users/labrown/Library/Automation/checkmail.sh</string>
</array>
<key>StartInterval</key>
<integer>120</integer>
</dict>
</plist>
But I'm unsettled by needing to specify a hard-coded path to my
script. Notice, in my crontab entry I was able to access HOME, but
when I try that in the plist, it is taken literally (without
expanding) and causes obvious problems.
HOME is set appropriately, and I can verify that by issuing the
'export' command to launchctl.
How does one work around this issue?
Thanks,
Levi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2415 bytes
Desc: not available
Url : http://lists.macosforge.org/pipermail/launchd-dev/attachments/20080304/7b2eadaa/attachment.bin
More information about the launchd-dev
mailing list