監控終端和進程的輸出工具:ispy

jopen 10年前發布 | 24K 次閱讀 iSpy

ISPY是一個Python工具,用于監控終端和進程的輸出。

Demo

ispywatching abashsession that lists some files and opensvim:

The same thing, usingstrace:

Installation

pip install ispy

Alternatively, if you aren't a Python person or don't want to install it (since it must be run as root), you can download a fully packaged pex file and run without installing:

wget https://github.com/dellis23/ispy/blob/master/bin/pex/ispy.pex?raw=true -O ispy; chmod +x ispy

Usage

# ispy <pid_to_watch>

Use Cases

  • Watching someone else's terminal
  • Watching the output of a backgrounded process

Notes

Not intended for production!

It's probably buggy.

This was mainly an exercise in learning aboutptracefor myself. I haven't done anything more than smoke testing on a couple of operating systems.

This uses the same system call asstrace(ptrace), which is heavy-handed and has a performance impact. It is not recommended to use in production or against mission-critical applications. It's also written in Python, so it's even slower.

Supported OSs

This has been tested as working on:

  • Ubuntu
  • CentOS

This has been tested as not working on:

  • OSX

項目主頁:http://www.baiduhome.net/lib/view/home/1450793594276

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!