From: Mark Hubbart Date: 2004-02-21T04:50:45+09:00 Subject: Re: Unix daemon conventions Hi, On Feb 20, 2004, at 9:34 AM, Robert K. wrote: > There might be better grouop, however I just finished writing a ruby > daemon script. The script, if called with uid==0, walks through all > useres homes. It tries to open a file each user and work according to > it's content. Rather like fetchmail. > It works. > Now what's wrong: > > I reduced the search on Uids 0 and >=500. Is this good/OK ? I'm not exactly sure about other platforms, but under Darwin/MacOSX, this would be appropriate. Any users that you miss are daemons anyway. Is it this way on other unices? > I do a test on the existence of a directory -- must be good. > For UID==0 I work the same as a normal user. I look for a ".file" in > root's home. Shall I better loock at /etc/file, or even both? Hmm... In my experience, "~root/.file" would be a configuration file specifically for the root user, whereas "/etc/file" (no dot) is a system-wide file, for all users. It would seem to me that the proper use for a "/etc/file" would be to load it first, before loading each user's "~/.file". Configurations from the user's dotfile would overwrite the ones from the system-wide one, as necessary. for example, everyone, root included, can have their own .bashrc file, but if there is a /etc/bashrc, it gets loaded before the dotfile, no matter which user; root or otherwise.