Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    tailing /var/account/pacct?

    So I want to watch processes as they finish executing and the data gets logged in process accounting. I run the latest version of fedora.

    I tried this:
    tail -f -c 0 /var/account/pacct | lastcomm -f -
    However it didn't work. It just sat there doing nothing. So I though maybe /var/account/pacct wasn't being written to at the end of execution. I checked the filesize as I executed files. I ran lastcomm -f /var/accout/pacct to make sure the new commands were showing up and everything was working.

    I took it a step further and tried just doing this:

    tail -f -c 0 /var/account/acct
    Sure enough, tail was refusing to feed out the data. I though it might be an EOF issue, so I tried -F instead.

    Anyone have any ideas how to make this happen? I assume it might be because the file is binary data, but there has to be a way around it.

  2. #2
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    The Keystone State
    Have your tried;

    tail -F /var/account/acct
    -c 0 is telling tail to output 0 bytes.

    -c, --bytes=N
    output the last N bytes


    The adventure of a life time.

    Linux User #296285
    Get Counted

  3. #3
    The `-c 0` part is fine. I am attempting to only output new data that is added to the file. If I returned any previous data, it could be partial data causing lastcomm to freak out. After some further reading, it seems that GNU tail isn't very good at supporting binary data in itself. Also piping any binary data to lastcomm is going to be a fruitless endevour as well, because it seems to throw the data in based on line breaks, where the pacct binary data has none. I'm probably going to have to write a perl script to read data as it is added to the file and do exactly what lastcomm does.

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts