Unix daemon conventions


(Robert K.) #1

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 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?


(Thomas Adam) #2

— “Robert K.” anon@nospam.de wrote:

I reduced the search on Uids 0 and >=500. Is this good/OK ?

0 -> 499. 500 is normally not assigned to normal users.

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?

I am not sure what you’re asking here… can you re-phrase it, please?

– Thomas Adam

···

=====
“The Linux Weekend Mechanic” – http://linuxgazette.net
"TAG Editor" – http://linuxgazette.net

" We’ll just save up your sins, Thomas, and punish
you for all of them at once when you get better. The
experience will probably kill you. :)"

– Benjamin A. Okopnik (Linux Gazette Technical Editor)


Yahoo! Messenger - Communicate instantly…"Ping"
your friends today! Download Messenger Now
http://uk.messenger.yahoo.com/download/index.html


(Mark Hubbart) #3

Hi,

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.

···

On Feb 20, 2004, at 9:34 AM, Robert K. wrote: