Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
perl スクリプトを使用してバックグラウンド プロセスとして Linux シェルで tcpdump を起動したいのですが、出力を解析してからプロセスを強制終了する必要があります。これどうやってするの ?
私 Unix では、伝統的な方法は、小さくて非常に特殊なプログラムを作成し、それらを一緒にパイプすることです。tcpdump の出力をスクリプトの stdin にパイプしてみませんか?
私のperlは少し錆びています:
$| = 1; my $pid = open(DUMP, "tcpdump -i eth1 -l -n 2>\&1 |"); while(<DUMP>) { # do something if($some_condition) { `kill $pid`; last; } }