![]() |
Hello and Welcome from to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| what is kill -6 command in unix | abhi_123 | UNIX for Dummies Questions & Answers | 2 | 06-20-2008 03:38 AM |
| Kill Command | sonali | UNIX for Dummies Questions & Answers | 4 | 01-03-2007 03:30 AM |
| the kill command | kelogs1347 | High Level Programming | 2 | 11-23-2006 04:23 AM |
| Is there anu command or way to kill zombis? | umen | UNIX for Dummies Questions & Answers | 4 | 05-21-2006 05:48 AM |
| kill command | Rush | UNIX for Dummies Questions & Answers | 1 | 03-27-2003 04:54 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
How to kill top command using script?
Hi all,
I am using top command in my script to redirect output to temp file. I used kill -9 `ps -ef|grep top|grep -v grep|awk '{print $2}'` to kill top command in my script, but it is not working? Can you please tell how to kill top command in my script? |
|
||||
|
If you are running it in the background, just store $! in a variable just after starting it, and kill $! when you need to.
top has options to tell how many iterations to run; perhaps you should be using those instead. Don't use kill -9 unless you know what you are doing. |
|
||||
|
Quote:
Code:
top -f /path/to/outfile |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|