- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- ksh scripting
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2003 11:07 PM
12-18-2003 11:07 PM
I have a question wich breakes my mind.
I have a script monitoring a log file for specific messages.
I use the construction:
tail -f $logfile | while read line
do
case $line in
ORA-*)
echo "Fout in logfile: $line
;;
esac
done
This script, written in KSH will run until the system is stopped or until i kill the script.
If i do this with kill -15 PID (of the script)
Tail stays behind in the process table with a parent process of 1
How do i stop this process together with my script ?
Kl@@s
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2003 11:17 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2003 11:18 PM
12-18-2003 11:18 PM
Re: ksh scripting
(tail enters
an endless loop wherein it sleeps for one second
then attempts to read and copy further records
from the input file)
So thats why there is a problem. I'm not sure of a solution yet :-) I'll continue looking.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2003 11:19 PM
12-18-2003 11:19 PM
Re: ksh scripting
you shouild be able to find both PID and kill them all in one go
kill -15 PID1 PID2
Regards,
Jean-Luc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2003 11:21 PM
12-18-2003 11:21 PM
Re: ksh scripting
Well it's friday my mind seems to be on leaf allready.
Kl@@S
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2003 11:21 PM
12-18-2003 11:21 PM
Re: ksh scripting
Mark Syder (like the drink but spelt different)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2003 04:12 AM
12-19-2003 04:12 AM
Re: ksh scripting
the script is run by who? By an interactive shell, with nohup or what? When you run it with nohup, you will have to kill the tail. Of course you can allways kill the shell too.
greetings,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2003 04:27 AM
12-19-2003 04:27 AM
Re: ksh scripting
-9 ??
Sledgehammer to catch a butterfly,
Use kill -9 as the very very last resort.
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2003 05:40 AM
12-19-2003 05:40 AM
Re: ksh scripting
As the other Mark G wrote, kill the "tail" process. It should go away with just a "kill". If you have to use a -9, you have other problems; however, your script is hardly that complex so you ought not have to resort to the -9.
mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2003 07:02 AM
12-19-2003 07:02 AM
Re: ksh scripting
$ ps -ef | grep tail
rhills 6725 6723 0 11:58:12 pts/tTb 0:00 tail -f /var/adm/syslog/syslog.log
rhills 6730 5560 2 11:58:18 pts/tt 0:00 grep tail
pegasus rhills $ kill -15 -6723
pegasus rhills $ ps -ef | grep tail
rhills 6744 5560 0 11:58:32 pts/tt 0:00 grep tail
I killed the pid 6723 (ksh parent of tail child) and it not only killed the ksh script, but also the tail.
Another alternative is to put a "trap" in your script, that when the ksh script is killed, it then kills the tail command.
HTH
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2003 10:17 AM
12-19-2003 10:17 AM
Re: ksh scripting
with -PID you send the signal to all the proces s group.
this ksh is not interactif so the other are run in its process group.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2003 11:03 AM
12-19-2003 11:03 AM
Re: ksh scripting
export JOBNUM=$$
$$ is the PID of the current script. You can store that and kill it later when ever you're ready.
Hope this helps
-Brian.