Re: Agents and daemons [DOUBT]
Re: Agents and daemons [DOUBT]
- Subject: Re: Agents and daemons [DOUBT]
- From: Tilghman Lesher <email@hidden>
- Date: Fri, 25 Mar 2011 02:53:12 -0500
- Reply-by: Wed, 19 Jan 2011 16:20:00 -0600
On Thursday 24 March 2011 22:36:15 Abhinav Tyagi wrote:
> Hi,
> I am new to background services or agents/daemons. I have been through
> the apple's technical note TN2083 entitled "Daemons and Agents".
The manpage, in this case, may be a better technical resource, although the
Technote certainly provides a lot of context.
> I have few doubts such as:
> (1) i am not able to launch an agent using launchctl in same way as i
> do launch my daemon. Also when I use LimitLoadToSessionType for agent
> plist, using launchctl to load the agent from terminal says "nothing
> to load" while removing this property successfully loads the
> executable.
As far as I can tell, there is very little difference, technically, between
launching a global Agent versus a global Daemon. The differences are
generally semantics, only, and it may help the human operator to
categorize them separately. In terms of the LimitLoadtoSessionType, what
session type are you using, and are you specifying that session type in the
'-S' flag to launchctl at the time of load/unload?
> (2) on copying the plist to /Library/LaunchAgents however launches the
> agent successfully and works as desired which i have noticed from
> system console logs. Does it mean the agents are restricted from
> launching from the terminal. If yes then whats the logic behind the
> fact that Daemons are allowed to register with launchd using launchctl
> but the agents are not?
Are you launching the items as your own user or as user root? Some of
the differences may be in terms of binding to ports below 1024, and other
privileged operations. Also, unless the user is logged in (via a GUI
session), the agents launched for that user generally will not run (but
they will be saved in the system to run, when that user next logs in).
> (3) And finally the most important thing: we specify sockets in the
> plist to register with the launchd on which our agent/daemon's request
> are received. But how is it possible for every person to know if any
> service is already using that port number or not because it is
> possible to have an existing daemon loaded and using same port and
> will be providing services to the applications. Any solution exist for
> this?
This is why there is no LaunchDaemons in a user's Library directory, only
LaunchAgents. You really shouldn't be running a daemon that binds to a
specific port, unless you are the system administrator. For other uses,
that aren't standard-port driven, you can bind to a random port, then use
Bonjour to register that port as a named service.
--
Tilghman
_______________________________________________
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