Solaris Crontab & TOP output


 
Thread Tools Search this Thread
Operating Systems Solaris Solaris Crontab & TOP output
# 1  
Old 03-17-2013
Code Solaris Crontab & TOP output

Hello Guru's

I'm trying to take the output of solaris top command and output to a txt file every few minutes. The issue that I'm experiencing is that I can run the following:
#!/bin/bash
#
logfile="/usr/mvf/morris/top.log"
# echo "*********************************************************************************************** ">> $logfile
# echo "`date`">> $logfile
echo "`top 10`" >> $logfile

However, we I place it in the crontab I just get the ***'s and date.... I never get the output of top written to the log file.

#check top loads
5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/mvf/morris/top_check >/dev/null 2>&1

Any Idea why ?
# 2  
Old 03-17-2013
Locate top command pathname:
Code:
$ which top
/usr/local/bin/top

Use absolute path in your script:
Code:
/usr/local/bin/top 10 >> "$logfile"

This User Gave Thanks to Yoda For This Post:
# 3  
Old 03-17-2013
Thanks Yoda !! That worked great ! Should have know better !

Cheers
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

If && command giving wrong output

Hi All, I am trying to run a script which will search for 2 strings(stopped,started) in a text file and echo an output depending on below condition -bash-3.2$ cat trial1.txt v ggg f -bash-3.2$ cat trial1.sh VAR9=` grep 'stopped' /tmp/trial1.txt` VAR10=` grep 'started'... (4 Replies)
Discussion started by: srkmish
4 Replies

2. Solaris

Solaris 9 Zone : Date command in crontab shows delayed(One Hour) output

SOLARIS 9 Zone : date command in crontab shows delayed(One Hour) output Hi folks, the date command shows the correct date and time, How ever, if the date command executed through crontab in any form of scrip the output shows as one hour delayed, similar to date -u.. Can some one help in... (12 Replies)
Discussion started by: judi
12 Replies

3. Shell Programming and Scripting

Problem with call of Java Programm & return code handling & output to several streams.

Hello Everybody, thanks in advance for spending some time in my problem. My problem is this: I want to call a java-Programm out of my shell skript, check if die return code is right, and split the output to the normal output and into a file. The following code doesn't work right, because in... (2 Replies)
Discussion started by: danifunny
2 Replies

4. Solaris

top output and swap -s output are differing

Solaris experts, Am struggling, and wondering for the past more than one week that, how to calculate the total available and used memory/swap space. Finally installed and used top & got some understanding, but while cross-checking, there are mismatches. Main Memory top o/p - 2GB... (7 Replies)
Discussion started by: thegeek
7 Replies

5. Shell Programming and Scripting

top output for six processes with the same name, output changed from column to row

Hi, I have a system under test, and I use a script that does a ps. The output, is in the following format, it's basically the timestamp, followed by the rss and vsize. 09:03:57 68404 183656 68312 181944 69860 217360 67536 182564 69072 183172 69032 199276 09:04:27 68752 183292 70000 189020... (5 Replies)
Discussion started by: Bloke
5 Replies

6. Shell Programming and Scripting

capturing output from top and format output

Hi all, I'd like to capture the output from the 'top' command to monitor my CPU and Mem utilisation.Currently my command isecho date `top -b -n1 | grep -e Cpu -e Mem` I get the output in 3 separate lines.Tue Feb 24 15:00:03 Cpu(s): 3.4% us, 8.5% sy .. .. Mem: 1011480k total, 226928k used, ....... (4 Replies)
Discussion started by: new2ss
4 Replies

7. HP-UX

HPUX & Top Command

Hello, I'm a newbie to HPUX so please be patient :) I'm looking at top and it only shows 3 of the 8 cpu's: 0 4 and 5. But the box has 8 cpu's according to the 'machinfo' command. There are 4 processes using 10% "%CPU" each but it shows the box as 90% idle...??? Also, I don't see any... (16 Replies)
Discussion started by: mj62mj62
16 Replies

8. UNIX for Advanced & Expert Users

top output

Hi all, below is the output of my 'top' Tasks: 91 total, 2 running, 89 sleeping, 0 stopped, 0 zombie Cpu(s): 3.9% us, 20.5% sy, 0.0% ni, 75.6% id, 0.0% wa, 0.0% hi, 0.0% si Can someone tell me what does us, sy,ni,id,wa,hi,si stands stand for? (4 Replies)
Discussion started by: new2ss
4 Replies

9. UNIX for Dummies Questions & Answers

BOX Status with vmstat & top Solaris 2.8

Hi there, I´m trying to get the information of vmstat & top in two different logfiles. That not that difficult. vmstat 30 >> myfile.log top >> myfile2.log But I also like to include a timestamp every 30 sec to be sure from what date the logs are. For the Top command I were able to... (2 Replies)
Discussion started by: isacs
2 Replies
Login or Register to Ask a Question