Forum Moderators: bakedjake

Message Too Old, No Replies

Cron and top

can get top to work

         

painless

3:08 am on May 8, 2006 (gmt 0)

10+ Year Member



I added this line using cron -e
*/10 * * * * /usr/bin/top -n1 > /tmp/toplog/top

the problem is the /tmp/toplog/top file is always empty. I can see from the file modification time that it's updated every ten minutes but it's still as empty as ever. Running the top command directly from the shell give the intended result ( the file isn't empty ) but i just can't get it to work using cron.

Please help

ChadSEO

8:18 pm on May 8, 2006 (gmt 0)

10+ Year Member



painless,

Welcome to WebmasterWorld!

When running top in a batch mode like this, you usually need to add the -b flag, ala:

*/10 * * * * /usr/bin/top -b -n1 > /tmp/toplog/top

Give that a try, hopefully it will work a little better for you.

Chad

painless

3:03 am on May 9, 2006 (gmt 0)

10+ Year Member



Thanks ChadSEO, it works now :)