­

httpd プロセス数の監視


5秒置きにhttpdプロセス数が何個立ち上がっていたかをタイムスタンプと共にファイルに記録したいので、
↓こんなシェルを用意した。

1#!/bin/sh
2while [ 1 ]
3do
4sleep 5
5ret_arr=(`ps -ef | grep '/usr/sbin/httpd' | wc`)
6num_str=${ret_arr[0]}
7echo $num_str | awk '{print strftime("%y/%m/%d %H:%M:%S"), $0 } {fflush() }' >> b.out
8done

タグ:
カテゴリー: WEB

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

*

次のHTML タグと属性が使えます: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

カテゴリー