Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I've got a series of production servers that I'd like to be able to run certain utilities on without having to SSH into the machine.

Unfortunately, some of those programs (top and iotop I've tried so far) require curses and/or a TERM environment variable to be set, and executing from the shell via SSH doesn't work:

$ ssh myserver top
TERM environment variable not set.
$ ssh myserver iotop
Traceback (most recent call last):
  File "/usr/sbin/iotop", line 16, in <module>
    main()
  File "/usr/lib/python2.7/dist-packages/iotop/ui.py", line 571, in main
    main_loop()
  File "/usr/lib/python2.7/dist-packages/iotop/ui.py", line 561, in <lambda>
    main_loop = lambda: run_iotop(options)
  File "/usr/lib/python2.7/dist-packages/iotop/ui.py", line 465, in run_iotop
    return curses.wrapper(run_iotop_window, options)
  File "/usr/lib/python2.7/curses/wrapper.py", line 22, in wrapper
    stdscr = curses.initscr()
  File "/usr/lib/python2.7/curses/__init__.py", line 33, in initscr
    fd=_sys.__stdout__.fileno())
_curses.error: setupterm: could not find terminal

Any tips? Is this possible?

share|improve this question

2 Answers 2

up vote 6 down vote accepted

You say you want to run them without ssh, yet you connect over ssh. This makes very little sense :)

I'll assume you want to run utilities over ssh without starting a shell. That's possible, just make ssh allocate a PTY for you even if it doesn't start a shell:

ssh -t myserver top
share|improve this answer

For "top" you can use the "batch mode" - many tools have this too:

ssh myhost top -bn1
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.