starting daemons in the startup context
starting daemons in the startup context
- Subject: starting daemons in the startup context
- From: Bill Janssen <email@hidden>
- Date: Fri, 27 Mar 2009 12:24:37 PDT
I'm writing a user-level daemon that periodically, in response to RPC
calls, runs other apps. By user-level, I mean that it runs as a
particular user, typically not an admin user. I need to be able to
let the user restart the daemon, too.
I'm running into problems with this setup, typically because the apps
run by the daemon start crashing after six hours or so of operation,
typically like this:
FAILED TO GET ASN FROM CORESERVICES so aborting.
I also see gethostbyname() failures, etc., presumably because the app
can't connect to lookupd.
I think this is all because the daemon is running in a 'login' bootstrap
context, instead of the 'startup' bootstrap context, and this context has
somehow 'decayed'. For instance, when I run
% sudo launchctl bslist 7942
bootstrap_info(): 268435459
%
which is a very odd result.
I see that in
http://developer.apple.com/DOCUMENTATION/DARWIN/Conceptual/KernelProgramming/contexts/contexts.html,
there's a paragraph saying,
``There are a number of ways to force a program to start in the startup
context without rebooting or using ssh. However, these are not robust
solutions, and are not recommended. A standard API for starting daemons
is under consideration. When an official API becomes available, this
chapter will be updated to discuss it.''
Presumably the standard API doesn't exist yet, or that page would have
been updated. So what are some of the 'number of ways'? Preferably
something that doesn't require the user to be an admin or sudoer.
Bill
_______________________________________________
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