The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to parse through a file and based on condition form another output file sivasu.india UNIX for Advanced & Expert Users 6 02-28-2008 01:59 AM
Creation of output file from list of file ganapati Shell Programming and Scripting 7 01-18-2008 04:55 PM
compare file size from a output file from a script moustik Shell Programming and Scripting 7 11-07-2007 07:17 AM
HP-UX and 'top' deckard HP-UX 8 07-21-2005 02:04 PM
Dual CPU's and 'top' hcclnoodles UNIX for Dummies Questions & Answers 3 07-17-2003 10:15 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 11-06-2007
Registered User
 

Join Date: Jan 2006
Posts: 125
catpure output of 'top' in a file

Code:
#!/bin/sh

echo `date +%F:%T` >> top.out

echo `top -n1` >> top.out
Hi all, i am trying to capture the output of the 'top' command in linux.

when i run the command manually, it works.

However, when i run it as a cronjob,the 'top' output is not being printed to the file,only the date is being printed. i have verified that the cron is working in the /var/log/cron file. any advise?

i found the mistake. i need to specify -b as as option to top.
Code:
top -b -n1
worked.

Last edited by new2ss; 11-06-2007 at 02:50 AM.
Reply With Quote
Forum Sponsor
  #2  
Old 11-06-2007
Registered User
 

Join Date: Jan 2007
Posts: 2,965
Check the path of top, eg use

which top

then use the fully qualified path to the top program in the script.


99% of cron problems are due to the assumptions about the environment.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 12:00 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0