Script for restarting apache at load 10

#!/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
About

anees

Posted in Apache, Scripts
2 comments on “Script for restarting apache at load 10
  1. LiewCF says:

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

    Like

  2. Anees says:

    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

    Like

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 )

Google+ photo

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

Connecting to %s

Blog Stats
  • 121,465 hits
Follow

Get every new post delivered to your Inbox.

Join 211 other followers

%d bloggers like this: