At 02:05 AM 8/8/00, you wrote:
>On Tue, Aug 08, 2000 at 01:24:48AM -0400, Todd Finney 
>wrote:
>! Couldn't you just do something like this in the rc 
>script
>! to get the correct pid every time?
>!
>! `ps  -C qmail-send | sed  's/^.\([0-9]*\).*/\1/' | tr -d 
>
>! [:space:]`
>
>I think you probably meant ``^.*'' instead of ``^.''.

eh, close enough for jazz.

>! [Note: There is probably a better way to do
>! this.  Suggestions are welcome.]
>
>If I remember correctly, this does pretty much the same 
>thing as
>``pidof'', except I think the latter is faster.

Excellent.  You previously mentioned pidof, but said that 
it wouldn't work.  I didn't test that statement.

>Even faster, I believe, is to simply write qmail-send's 
>pid to
>/var/run/qmail.pid, as suggested in my previous post; then 
>you don't
>even have to search through all the processes, as ``ps'' 
>and ``pidof''
>have to.

I don't know which one would be faster.  Speed really isn't 
an issue in this case though, is it?  You only need to get 
the pid when you run the rc script, and that is (hopefully) 
not a regular occurrence.   Also, the time it takes to scan 
the process list is probably trivial when compared with the 
time it takes to restart qmail-send.

If the qmail-rcfile file is already set up to look for the 
qmail pid, changing where it looks for it is a simple 
search and replace.  You have to change the file anyway if 
you're implementing the qmail.pid solution, and pidof saves 
you the trouble of adding the (admittedly minor) pid 
recording function.

pidof, a win by 44 characters?

cheers,
Todd



Reply via email to