Matthew Soffen wrote:
> Morning all.
> 
> I'm trying to get basic sanity check running on FreeBSD.
> 
> There appears to be a problem with one method in the shellfuncs that
> cause it to fail on FreeBSD.
> 
> ha_clustermsg() {
>        cat $* <<-!MSG >> $HA_FIFO
>>>>
> `cat`
> <<<
> !MSG
> }
> 
> 
> The ">>> `cat` <<<" appears to be the problem.   If I comment it out,
> then things work fine.   What exactly is this trying to do ?

It's trying to put something that looks like this into $HA_FIFO
>>>
--contents of standard input--
<<<

This is a standard shell construct.  In a here document, you can always
include the results of any commands in `` quotes.  Those commands are
run, and their results are substituted into the here document inline.

So, if I said `date` it would replace `date` with the standard output
from the date command.  In this case, it runs 'cat' and should replace
it with whatever cat outputs (which given no arguments would be the
contents of standard input).

One could probably rewrite it like this:
(echo '>>>'; cat; echo '<<<') | cat >>$HA_FIFO

I included the cat to try and encourage all the output go into the FIFO
in one write system call.   If I don't do that, then I know _for sure_
that it will use at least 3 write system calls to the fifo.

-- 
    Alan Robertson <[EMAIL PROTECTED]>

"Openness is the foundation and preservative of friendship...  Let me
claim from you at all times your undisguised opinions." - William
Wilberforce
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to