Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google site



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 !!

Closed Thread
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-06-2007
Registered User
 

Join Date: Jan 2006
Posts: 133
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 05:50 AM..
Sponsored Links
  #2 (permalink)  
Old 11-06-2007
porter porter is offline Forum Advisor  
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.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


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 04:59 AM
Creation of output file from list of file ganapati Shell Programming and Scripting 7 01-18-2008 07:55 PM
compare file size from a output file from a script moustik Shell Programming and Scripting 7 11-07-2007 10:17 AM
HP-UX and 'top' deckard HP-UX 8 07-21-2005 06:04 PM
Dual CPU's and 'top' hcclnoodles UNIX for Dummies Questions & Answers 3 07-17-2003 02:15 PM



All times are GMT -4. The time now is 06:41 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2010. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0