#!/bin/bash
# Script to Monitor Apache Load
# Regards, to all L!nux3rZ@ LinuxAC.Org
#
#
# To use for example:
# ./apmon.sh 5 
# The above example shall run 5 times and processes 5 output files.
#
#
# To make the script run until you stop it do the following:
# Replace the for loop with: 
# while true; do top -b -n $1 | grep wwwrun >> /root/$today; done;

today=$(date +%Y-%m-%d:%T);

ITERATION=$1;

for (( i=1; i<=ITERATION; i++ ))
do
top -b -n $1 | grep wwwrun >> /root/$today
done

