August 22nd, 2003, 12:08 PM
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
August 22nd, 2003, 04:15 PM
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.
August 22nd, 2003, 04:22 PM
I can't even kill the tail -f from the command line with <ctrl>-c not to mention the C proram that implements it.
August 22nd, 2003, 04:29 PM
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.
August 22nd, 2003, 04:34 PM
Thank you, I figured it out.