Re: starting daemons in the startup context
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:subject :mime-version:date:references:x-mailer; bh=oSusSOYUIH0dUgS1gWEd4Nz4SJmNtmQXjLh5B3S/wQg=; b=DDlVYUMg6RpuDuZ+mQj5xrSuJxjVPJGYehe7wefRJFEnY4ZzEoXbczkyoj0Rr+/1qF FZjVqbAtAkulxanK8xoKhFN7GWxwdcA8531bv5HlIT3CpPQUV1MnJ7HoNe3oUoOQbXMU oweir8mm0/RAk1FGFKxHv35vmunEKjGjy+3mA= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:in-reply-to:content-type :content-transfer-encoding:subject:mime-version:date:references :x-mailer; b=eCwBoN8oFAxhUurarKd6T8uRp8pun7duYtnNJPYInGeyJ5/rRDjaG09QO904DEdfnw 3Z9pq7pj7x6/lU3woes4J3TmhGodXFlSGJbb7LfB2cUoAukVXnle+axIm3BKrSHB9IjK 4f9qXxYWy1p4xbAazOqUUDz1xfmmCZYVU3p9c= On Mar 27, 2009, at 12:24 PM, Bill Janssen wrote: 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. % sudo launchctl bslist 7942 bootstrap_info(): 268435459 % which is a very odd result. 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, For 10.4 support, there is 'loginhook'... Eli _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... 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 I see that in http://developer.apple.com/DOCUMENTATION/DARWIN/Conceptual/KernelProgramming... , 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.'' Bill First, if you can require 10.5, have you looked at launchagents (which only launch when a user logs in, and run as the logged in user vs launchdaemons, which launch typically at startup, and aren't linked to logged in users). It's my understanding that these execute in the user's context, and not the bootstrap context. I haven't specific experience with it, but if they are run as the logged in user, the user should be able to start/stop it (for themselves) without having to provide admin authority. And the web page you mention doesn't seem to have been updated with info about launchd/launchctl, which should also provide you with valuable information. This email sent to site_archiver@lists.apple.com
participants (1)
-
Eli Bach