Script for restarting apache at load 10

5 04 2009

#!/bin/bash
loadavg=$(uptime | awk -F “.” ‘{ print $1 }’ | awk -F “:” ‘{ print $5 }’)
if [ "$loadavg" -ge "10" ]; then
pkill -9 httpd
sleep 3
/scripts/restartsrv_httpd
fi

About these ads

Actions

Information

2 responses

24 09 2010
LiewCF

where should I save this script and how to run it?

24 09 2010
Anees

You can run this script from shell.
Save this script to any test file (eg: apache10.sh) and run by using the command:
sh apache10.sh

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s




Follow

Get every new post delivered to your Inbox.

%d bloggers like this: