Is it better to have one daemon or many daemons?
I know the answer is supposed to be one daemon. That's why we have inetd.
However, I am running a bunch of small bash scripts as daemons to watch
directories to enable xv's visual schnauzer to be used as a slide sorter.
Here is my process table:
23817 pts/1    S      0:00 /bin/bash ./exchange.scr
23818 pts/1    S      0:00 /bin/bash ./delete.scr
23822 pts/1    S      0:00 /bin/bash ./label.scr
23823 pts/1    S      0:00 /bin/bash ./move.scr
23824 pts/1    S      0:00 /bin/bash ./restore.scr
23831 pts/1    S      0:00 /bin/bash ./renumber.scr
23832 pts/1    S      0:00 /bin/bash ./duplicate.scr
23833 pts/1    S      0:00 /bin/bash ./startxv.scr
 2616 pts/1    S      0:02 xv -vsmap -vsgeometry 1000x680 -geometry 75x50
 4028 pts/1    S      0:00 sleep 1
 4030 pts/1    S      0:00 sleep 1
 4032 pts/1    S      0:00 sleep 1
 4037 pts/1    S      0:00 sleep 1
 4039 pts/1    S      0:00 sleep 1
 4041 pts/1    S      0:00 sleep 1
 4043 pts/1    S      0:00 sleep 1                      

Each daemon looks at a particular directory. If it is empty, it sleeps
for a second. If it is not empty, it does stuff, eg., renames files,
labels them with convert, mv's them to other directories, and so on. When
it is done, each daemon kills xv, and the startxv.scr script restarts xv. This
latter nuisance is because the visual schnauzer has to be updated by hand
if you don't restart xv.

Essentially, each daemon is an independent contractor.  That is to say,
they all operate independently. That made programming this fairly simple.

Things seems to be working. However, before I turn this loose at
work, is this approach feasible? For example, would I be better off
making one big daemon?

In theory, an impatient user might move faster than the daemons
(old, slow bash scripts), and a collision might occur. For example,
if they tried to delete slides while the fairly slow labeling daemon
was running, this might cause some interesting effects.

Would it be feasible to cascade the daemons? That is to say, could
the daemons call each other sequentially, thereby at least avoiding
collisions? Or, would a master script which calls each daemon
sequentially be preferable?

Any comments appreciated,

Joel

_______________________________________________
Linux-users mailing list
[EMAIL PROTECTED]
Unsubscribe/Suspend/Etc -> http://www.linux-sxs.org/mailman/listinfo/linux-users

Reply via email to