12

I have a problem executing a cron process to check current CPU use in my server.

My script start with:

top -c -n 1 -u www-data > /tmp/kill-cpu

I can execute without problem in console, but in cron I get

top: failed tty get

If I use the -b option to top

top -b -n 1

I get

'dumb': unknown terminal type.

I'm using xterm as TERM

Thanks for your help :)
Lito.

SOLUTION: I was able to solve the problem with:

ln -s /lib/terminfo/d/dumb /usr/share/terminfo/d/dumb
Lito
  • 275

1 Answers1

9

You can try something like:

TERM=vt100 top -b -n 1

This will set the TERM variable to execute with the "top" command.

But your underlying problem is that your termcap database is incomplete or broken. I don't have a Debian machine to look at, but on an Ubuntu box, the "dumb" termcap info is in the file /usr/share/terminfo/d/dumb. This file is part of the ncurses-base package on Ubuntu 8.04 and 10.04. On RHEL, it's part of the ncurses package. Perhaps your installation is simply missing this file?

cjc
  • 25,492