• 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: A Couple launchd user agent questions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A Couple launchd user agent questions


  • Subject: Re: A Couple launchd user agent questions
  • From: Keith Duncan <email@hidden>
  • Date: Wed, 20 Feb 2008 20:16:55 +0000

2) I'm assuming that should call "launchctl unload my-agent.plist" during my installer preflight and will shut down all copies in all users and then call "launchctl load my-agent.plist" in my postfight to bring it back up for all users. Are there any other issues I need to worry about -- like if a running application has a connection to one of my agents mach ports?

Installing the plists requires admin authorization, as such the scripts will be run as root. When starting/stopping the agent you need to run the command in the context of the user. You're also going to want to check for the presence of the file before unloading it in the preinstall script, else the script . My preinstall script is below for reference -


#!/bin/sh

if [ -f /Library/LaunchAgents/dawnAlarma.plist ]; then
su $USER -c 'launchctl unload /Library/LaunchAgents/ com.buoy.dawnAlarma.plist'
fi


You are right to be concerned about closing the mach ports that applications could be connected to. I solved this by writing a simple wrapper around NSConnection which auto-reconnects. I'm also working on one which saves and forwards messages once the connection has been re- established, that way the wrapper client doesn't need to be concerned with the status of the link. Other than that I haven't found any issues from stopping and restarting the agent.

Keith
_______________________________________________
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


References: 
 >A Couple launchd user agent questions (From: Steve Sisak <email@hidden>)

  • Prev by Date: A Couple launchd user agent questions
  • Next by Date: Re: Darwin-dev Digest, Vol 5, Issue 53
  • Previous by thread: A Couple launchd user agent questions
  • Next by thread: Re: Darwin-dev Digest, Vol 5, Issue 53
  • Index(es):
    • Date
    • Thread