[launchd-dev] Technical Question

Quinn eskimo1 at apple.com
Wed Sep 17 01:51:27 PDT 2008


At 22:05 +0200 16/9/08, Jan Michael wrote:
>So the question is now. It is possible to have a script like that work
>with launchd? What do I have done wrong?

The problem here is that a process started by your script is 
outliving your script.  launchd detects this are automatically 
garbage collects the errant process.  This is discussed in detail in 
the "Careful With That Fork, Eugene" section of TN2083.

<http://developer.apple.com/technotes/tn2005/tn2083.html>

In this specific case the problem is the ampersand at the end of line 
2 of your script.  That causes the contents of line 2 to run in the 
background.  The script then exits, launchd detects the stray 
process, and cleans them up.  It looks like your script is meant to 
run forever.  In that case, you don't need the ampersand.

S+E
-- 
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware


More information about the launchd-dev mailing list