Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 08-13-2003, 10:08 PM   #1
LQ Guru
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
killing tail --pid=???


I am working on a project where I know nothing about what I'm doing as usual.

So here goes..

I have a script the runs from another like this
$SCRIPTDIR/oblog Overwrite &
echo $! > $PIDDIR/
the script is like this
if [ "$1" = "Overwrite" ]; then
tail -f $DATADIR/$FNAME.raw |sed -e 's/^~...//' |grep -f $GREPFILE > $DATADIR/$FNAME.ob
I can close the script down like this
kill -1 `cat $PIDDIR/`

tail, sed, and grep are still running
I want to kill off tail so sed and grep will finish

Maybe some use of --pid with tail, I would need to pipe something to it to do that, not sure
some other signal maybe?
any ideas?


Last edited by DavidPhillips; 08-13-2003 at 10:10 PM.
Old 08-13-2003, 10:48 PM   #2
Senior Member
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821

Rep: Reputation: 121Reputation: 121
The only think I can think of off hand is to write a kill script that will kill the tail. Pass in the oblog PID


for i in `ps -ef | grep tail`; do
   ID=`echo $i | awk ' { print $3 } '`
   if [ $ID -eq $1 ]; then
      echo kill  `echo $i | awk ' { print $2 } '`
Remove the echo when you are ready to kill.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell Scripting: Getting a pid and killing it via a shell script topcat Programming 15 10-28-2007 02:14 AM
/var/run/[XXX].pid - Tcl pid code liguorir Linux - Software 1 05-20-2004 10:32 PM
ERROR: Couldn't write pid to pid file lawrencegoodman Linux - Newbie 2 02-13-2004 08:05 PM
Killing a pid in C++ pilot1 Programming 4 09-20-2003 10:07 AM
finding a PID and killing it tangle Linux - General 3 01-25-2003 10:14 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:08 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration