• 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: Launch a System Agent from an Installer script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Launch a System Agent from an Installer script


  • Subject: Re: Launch a System Agent from an Installer script
  • From: Bill Coderre <email@hidden>
  • Date: Sun, 11 Dec 2011 01:49:43 -0800

On Dec 10, 2011, at 10:18 PM, Eli Bach2 wrote:
> On Dec 10, 2011, at 10:45 PM, Nick wrote:
>> The systems are Snow Leopard and Lion, it also would be great if I
>> could do that on Leopard.
>
> What do you expect to happen if:
>
> -more than one user is logged in
> -nobody is logged in
> -your agent is already running in any/all user contexts

Nick, pay attention to what Eli says. It's important.

Also, the installer stuffs the short user name of the user that double-clicked your installer in the environment variable USER.

So you can do something like
su $USER -c "launchctl <whatever"

But, what if you want to do it for all users on the system?

The pretty-good solution is to walk through /Users and find all the real users, and do the above for each.

The better solution is to do the above, AND also deal with $USER. (Because the logged-in user might have a network home directory).

ANOTHER solution is to ask dscl (dscl . list /users) -- but most of the users on that list are not the kind that sit at the console.

None of these handles the case of users created after the installation runs.

Yeah, it's not as easy as it sounds.

Best of luck, and don't go creating daemons that eat all my computer up.
bc _______________________________________________
Do not post admin requests to the list. They will be ignored.
Installer-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Launch a System Agent from an Installer script (From: Nick <email@hidden>)
 >Re: Launch a System Agent from an Installer script (From: Eli Bach2 <email@hidden>)

  • Prev by Date: Re: Launch a System Agent from an Installer script
  • Next by Date: Re: Launch a System Agent from an Installer script
  • Previous by thread: Re: Launch a System Agent from an Installer script
  • Next by thread: Re: Launch a System Agent from an Installer script
  • Index(es):
    • Date
    • Thread