Operating System - Linux
1748195 Members
2978 Online
108759 Solutions
New Discussion

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

 
Laurent Menase
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
James R. Ferguson
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...