On 2004.4.30, at 04:30 PM, Sherm Pendley wrote:

On Apr 30, 2004, at 2:24 AM, Joel Rees wrote:

When I'm logged in as a user, I can set the appropriate environmen variables, but when a daemon is running, where is it going to get them?

Daemons are started from scripts found in /System/Library/StartupItems (for Apple-provided daemons), or /Library/StartupItems (for your own).


Startup scripts usually include /etc/rc.common, so if you want to export an env variable for *all* daemons, that would be a good place to do it. Be aware that /etc/rc.common is a system file though; Apple-supplied OS updates might overwrite it, so keep a backup just in case.

Thanks. I needed that information, because I had forgotten that Mac OS X doesn't use the rc/* convention. Don't look like there are any hooks for an rc.local. An rc script for the daemon would be handy for setting an environment variable.


Hmm. There are plists in those startup items. I wonder if I can pervert those. Time to dig out my copy of in-a-nutshell and see if there are enought clues there.

If you're writing a daemon,

Well, I'm still vacillating between a cron job and a daemon. I'm writing my own update tool for dynamic dns for the experience. (My ISP wants $60 a month for one static IP.) It'll screen-scrape the router/modem's setup pages for some Japanese text. I'm sure I could modify somebody else's script, but I have this cowboy mentality, at least until I learn how to read Perl for meaning instead of just function.


you might also want to be aware of /etc/hostconfig.

Yeah, I needed to look in there, too.

This sets a series of flags that indicate what daemons should be started. At system startup, *all* of the items in the StartupItems folders are run, so they check for the corresponding flag to see if they should actually start their service.

Yep, that's where I can turn sendmail on, once I figure out some configuration details, and I want that so my script can report problems updating and not just log them. Well, that's for another day.


Thanks, Sherm. I have to admit I get lost less with a little prompting.

--
Joel Rees



Reply via email to