LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


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

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


Howdy!

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
Code:
$SCRIPTDIR/oblog Overwrite &
echo $! > $PIDDIR/oblog.pid
the script is like this
Code:
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
Code:
kill -1 `cat $PIDDIR/oblog.pid`

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?

thanks,

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

Rep: Reputation: 120Reputation: 120
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
Code:
#!/bin/sh

IFS='
'

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 } '`
   fi
done
Remove the echo when you are ready to kill.
 
  


Reply


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 03:14 AM
/var/run/[XXX].pid - Tcl pid code liguorir Linux - Software 1 05-20-2004 11:32 PM
ERROR: Couldn't write pid to pid file lawrencegoodman Linux - Newbie 2 02-13-2004 09:05 PM
Killing a pid in C++ pilot1 Programming 4 09-20-2003 11:07 AM
finding a PID and killing it tangle Linux - General 3 01-25-2003 11:14 PM


All times are GMT -5. The time now is 12:38 PM.

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