#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    38
    Rep Power
    12

    Stopping a "tail -f file"


    Is it possible to stop a tail -f on a log file. It keeps looping and checking if the file has been updated, which is what I need, but is there any way of stopping it once it starts.

    tail -f LOG
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Jersey
    Posts
    64
    Rep Power
    12
    Depends on if you're running it from a script or not. The usual way to kill a tial -f is to issue a <ctrl>-c to it, that will stop the tailing to the screen.

    If in a script, I believe you'd have to issue the same, but inside the script.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    38
    Rep Power
    12
    I can't even kill the tail -f from the command line with <ctrl>-c not to mention the C proram that implements it.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Jersey
    Posts
    64
    Rep Power
    12
    Ok then, have you tried to kill the pid?

    Find out what the pid is:

    ps -ax | grep tail (Linux, FreeBSD)

    ps -ae | grep tail (Solaris)

    It should give you output like:

    bash-2.03$ ps -ae |grep tail
    18794 pts/21 0:00 tail

    Then, kill it for good:

    bash-2.03$ kill -9 18794

    Obviously, substitute your number for the above.

    If no results come up in the grep, then try grepping for the parent program name, i.e. the program which is calling the tail.

    -Gary
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    38
    Rep Power
    12
    Thank you, I figured it out.

IMN logo majestic logo threadwatch logo seochat tools logo