Thanks, Tim, and excellent timing: Mike is working on the docbook for this 
sensor today!

Mike, please incorporate.

Cheers,
Philip

--On Monday, October 10, 2005 6:19 PM -0700 Tim Shadel <[EMAIL PROTECTED]> 
wrote:

I got the CLI sensor working on bash on my Mac (OSX 10.4) today.  You
guys probably have already done this, but here's what I did using the
6.8.1007 CLI sensor:

1. Install darwin ports (more than one command, see URL) [1]
2. Install the bash port [2]
      % sudo port install bash
3. Symlink /bin/bash to /opt/local/bin/bash
      % sudo mv /bin/bash /bin/bash-orig
      % sudo ln -s /opt/local/bin/bash /bin/bash
4. Check version
      % /bin/bash --version
      GNU bash, version 3.00.16(1)-release (powerpc-apple-darwin8.2.0)
      Copyright (C) 2004 Free Software Foundation, Inc.
5. Change .logout to .bash_logout
      % mv ~/.logout ~/.bash_logout
6. Change history -S to a few other commands.  Force a history file
write.  Add the '+' sign to all timestamps (I'm assuming that the '+'
means something like 'after the epoch', so for all practical purposes,
everything will be '+').  I found the file format from [3].
      % vi ~/.bash_logout
      #history -S history.hacky.cli
      history -w
      cat $HISTFILE | sed -e "s/^#\([1-9]\)/#+\1/" > history.hacky.cli
7. Symlink .logout so hackyInstaller still works (I'm really hoping
that it won't overwrite my changes -- just that it'll still recognize
that the CLI sensor is installed.  If not, then perhaps these changes
should be incorporated into hackyInstaller.
      % ln -s ~/.bash_logout ~/.logout
8. Test CLI sensor according to docs.  66 CLI data entries received
for today. Groovy.  :-)

Issues
----------

A.  I found a cut-and-paste error in the appendix for the CLI sensor.
In the section, "A.5.2.4. Configure and install the Unix CLI sensor"
the text refers to the Ant build sensor.  No biggie.

B.  Is the '+' hack really necessary?  I don't know how sensitive the
hackyCLI parser is to the file format.  If it could handle files with
or without the '+' then we can get rid of this hack.

C.  The 'history -w' may not really be the best command to use; just
the simplest.  If you, like me, often have multiple shells open, then
this may or may not work.  I haven't thought through all the
scenarios, but I did run across this blog entry [4] that discusses the
history file across multiple shells.

Let me know if this works for anyone else.  I'm happy to be using the
CLI with Bash. :-)  Thanks for finding the time feature in bash 3.0!

--Tim

[1]  http://darwinports.com/
[2]  http://bash.darwinports.com/
[3]  https://www.redhat.com/archives/taroon-list/2004-September/msg00353.html
[4]  http://tech.rufy.com/entry/72

On 9/9/05, Mike Paulding <[EMAIL PROTECTED]> wrote:
Hey Tim,

Thanks.  Yeah, we found that the hard way as well and it will certainly
be in the docs.

Best regards,
Mike


Tim Shadel wrote:

> I was looking to get this setup on my Mac, but it appears that the
> HISTTIMEFORMAT is a bash 3.0+ feature and my Mac OS X 10.4 only has
> 2.0 by default.
>
> http://www.freelinuxcdrom.com/LDP/LDP/abs/html/histcommands.html
>
> ~ tim$ bash --version
> GNU bash, version 2.05b.0(1)-release (powerpc-apple-darwin8.0)
> Copyright (C) 2002 Free Software Foundation, Inc.
>
> I guess a port is available here, http://bash.darwinports.com/, but I
> haven't tried that yet.  Anyway, something to consider for the docs.
>
> Thanks,
>
> Tim
>
> On 8/20/05, Mike Paulding <[EMAIL PROTECTED]> wrote:
>
>
>> Excellent news, Cedric.  That adds a whole new user base for our CLI sensor.
>>
>> I will work on updating the documentation.
>>
>> Thanks,
>> Mike
>>
>>
>> (Cedric) Qin ZHANG wrote:
>>
>>
>>
>>> Hi,
>>>
>>> I was just reading bash documentation, and realized that our command
>>> line invocation sensor can be used with BASH.
>>>
>>> The problem we encountered was that bash history does not contain a
>>> time stamp field. It turns out that there is a bash shell variable
>>> that controls the time stamp setting. You can try to set
>>> HISTTIMEFORMAT='%H:%M:%S '
>>> and see what happens when you type 'history'.
>>>
>>> The format string is documented in <time.h> strftime() function. It
>>> can be changed to match csh time stamp format. So what we actually
>>> need is just some extra user documentation for our sensor to work with
>>> bash.
>>>
>>> Cheers,
>>>
>>> Cedric
>>>
>>>
>>>
>
>
>


Reply via email to