The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 08-04-2008
shamrock shamrock is offline Forum Advisor  
Registered User
  
 

Join Date: Oct 2007
Location: USA
Posts: 750
Quote:
Originally Posted by johnl View Post
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?
Use the -f option to top...it outputs one display to the named file and exits automatically.

Code:
top -f /path/to/outfile