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 ?

Locate top command pathname:

$ which top
/usr/local/bin/top

Use absolute path in your script:

/usr/local/bin/top 10 >> "$logfile" 
1 Like

Thanks Yoda !! That worked great ! Should have know better !

Cheers