0

i run the command on a Linux server.it works well.

/usr/bin/echo q | /usr/bin/htop | /usr/local/bin/aha --stylesheet --line-fix >> htop.html

but i run remote command with python exec_command . it work not well. the html is blank.

client.exec_command("/usr/bin/echo q | /usr/bin/htop | aha --black --line-fix >> htop.html")

who can tell me the reason?

dataorz
  • 11
  • 1
  • 5
  • In the original command the `aha` binary is full path. Why in the python script you use relative? – Chen A. Aug 08 '17 at 07:34
  • thanks. i change aha binary to full path. but htop.html is still blank. – dataorz Aug 08 '17 at 07:44
  • i have tried client.exec_command("/path/htop.sh") . and htop.sh's content is /usr/bin/echo q | /usr/bin/htop | /usr/local/bin/aha --stylesheet --line-fix >> htop.html . htop.html is still lank. – dataorz Aug 08 '17 at 08:02
  • When I try executing your command, I get an empty file. Unless `aha` binary do something with the output so it becomes readable, you end up with empty file. – Chen A. Aug 08 '17 at 10:40
  • You might find this thread useful https://stackoverflow.com/questions/17534591/htop-output-to-human-readable-file and you can use `top -b` which is `batch` mode that dumps the output wherever you need. – Chen A. Aug 08 '17 at 10:57

0 Answers0