I wrote this simple bash script so I could tell the server’s current load by email. The script is run every 15 minutes and very lightweight.

#!/bin/bash

LOAD=`uptime | awk -F: ‘{print $5}’ | awk -F\, ‘{print $1}’`
RCPT=”kamotegirl@pinoytux.com”
TIMESTAMP=`date +%D\ %T\ %Z`

`uptime|mail -s “Server Load as of $TIMESTAMP is $LOAD” $RCPT`

Then setup the cronjob to execute the script to run every 15 minutes and send an email to the RCPT.


*/15 * * * * /home/bom/load_alert.sh > /dev/null

Popularity: 6% [?]

Share and Enjoy:
  • E-mail this story to a friend!
  • StumbleUpon
  • Digg
  • Technorati
  • del.icio.us
  • Reddit
  • Facebook
  • Google
  • Slashdot
  • Blogosphere News
  • TwitThis
  • NewsVine
  • Propeller
  • Furl
  • Simpy
  • Spurl

Related Posts