My mac osx launched plist won't run

僤鯓⒐⒋嵵緔 提交于 2019-12-11 11:41:49

问题


it looks like it loads but has a status of 1 when using launchctl list and using launchctl start ... it says No such Process... i have it saved in /Users/IMG/Library/LaunchAgents. The sh script runs fine. the logging doesn't show anything - no file created.. I am very new to plist so please forgive ignorance.

<?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.IMG.shed</string>
    <key>ProgramArguments</key>
    <array>
        <string>/Users/IMG/2012/Dropbox/Dev_2012/Java/sh_IMG.sh</string>
    </array>
    <key>StandardOutPath</key>
    <string>myjob.log</string>
    <key>StandardErrorPath</key>
    <string>myjob.log</string>
    <key>Debug</key>
    <true/>

    <key>RunAtLoad</key>
    <true/>
    <key>StartInterval</key>
    <integer>60</integer>
</dict>
</plist>

回答1:


The first thing I thought was the process does not have permission to create the standard output log file (although I imagine the default value for working directory for a personal agent would be the user's home directory). There is an optional property key for WorkingDirectory - perhaps try setting that to see if anything changes.

Reference: Launchd.plist man page




回答2:


In XCode 4.5.2, under the Product menu, you need to pick Edit Scheme. You will see the manage schemes box appear with several schemes. One of these is called Run <ProjectName>. Click the checkbox next to Working Directory Use custom working directory and point that to the path where your plist is at.

This elaborates on the answer given by unhillbilly. So thanks unhillbilly for steering me towards the Working Directory.



来源:https://stackoverflow.com/questions/10271467/my-mac-osx-launched-plist-wont-run

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!