Quantcast
Channel: takeHoのへなちょこ日記
Viewing all articles
Browse latest Browse all 6

プロセスの監視

$
0
0
クーロンとシェルスクリプトの組み合わせによるものです。 当然、利用に伴う常駐プロセスが増える事はありません。
#!/bin/bash

# limit is Specify the maximum number of process.
limit=400

pids=$(ps aux | grep httpd | awk '{print $2}' | sort)
process_count=$(ps aux | grep httpd | awk '{print $1}')
timestamp=$(date)

if [ $process_count -gt $limit ];
then
for pid in ${pids[@]}
do
$(kill -9 ${pid})
exit 1
done
fi

Viewing all articles
Browse latest Browse all 6

Latest Images

Trending Articles



Latest Images