Languages and Scripting
cancel
Showing results for 
Search instead for 
Did you mean: 

Why doesn't top command work in my script?

 
Highlighted
Honored Contributor

Re: Why doesn't top command work in my script?

Hi
How do you start that script?
cron? startup? command line?
Is there any error message?
just try TERM=xterm /usr/bin/top -h -d 1 >>$LOG_NM
Highlighted
Acclaimed Contributor

Re: Why doesn't top command work in my script?

Hi (again) Nguyen:

> change my script as:
===
GetDate=`date +"%Y%m%d"`
LOG_NM=/home/hoanglh/report$GetDate
who -q|grep users>>$LOG_NM
sar -d 5 5 >>$LOG_NM
/usr/bin/top -h bd1 -f $LOG_NM
==

> But top command doesn't works.

Your switches and arguments to 'top' are wrong.

You have:

/usr/bin/top -h bd1 -f $LOG_NM

...which needs to be:

/usr/bin/top -h -d1 -f $LOG_NM

Regards!

...JRF...