• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Fwd: StartupItems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fwd: StartupItems


  • Subject: Re: Fwd: StartupItems
  • From: email@hidden (Peter Seebach)
  • Date: Sun, 04 Jun 2006 14:22:58 -0500

Hmm.  Well, maybe someone can tell me what I'm doing wrong with launchd.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
        "http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
<plist version="1.0">
<dict>
        <key>Label</key>
        <string>localhost.script_name</string>
        <key>UserName</key>
        <string>kodak</string>
        <key>ProgramArguments</key>
        <array>
                <string>/path/to/program</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
</dict>
</plist>

This launchd item, placed in /Library/LaunchDaemons, never gets run.

Why?

Jun  4 12:06:18 localhost launchd: localhost.script_name: getpwnam("kodak") failed
Jun  4 12:06:18 localhost launchd: localhost.script_name: exited with exit code: 1
Jun  4 12:06:18 localhost launchd: localhost.script_name: 9 more failures without living at least 60 seconds will cause job removal

Does the user exist?  Why, yes.  This is not only a user on the system, but
the user that gets automatically logged in once the system is booted.

So what happens?  Launchd tries to launch this before the netinfo stuff is all
up, and ends up yanking it from the job list, not because the script or daemon
is problematic... But because the UserName key isn't viable yet.

It doesn't matter what's in the ProgramArguments, because the program never
gets to being spawned, because the UserName doesn't work.
Doesn't this mean launchd ought to, hmm.  Maybe check for availability of
NetInfo before trying to spawn a job, then killing it for lack of resources?

If "don't just suicide when your resources aren't available" is such good
advice for programs in a launchd world, why doesn't launchd follow it?

-s
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • launchd's job jettison logic (Was: Re: StartupItems)
      • From: Dave Zarzycki <email@hidden>
    • Re: StartupItems
      • From: John Fieber <email@hidden>
References: 
 >Re: Fwd: StartupItems (From: email@hidden (Peter Seebach))

  • Prev by Date: Re: GNU-Darwin: missing code in Darwin
  • Next by Date: Re: [Gnu-darwin-distribution] GNU-Darwin: missing code in Darwin
  • Previous by thread: Re: Fwd: StartupItems
  • Next by thread: Re: StartupItems
  • Index(es):
    • Date
    • Thread