Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Programming/Scripts

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Thread Tools Display Modes
Old 7th October 2011, 14:37
duster duster is offline
Junior Member
Join Date: Jun 2011
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Monitoring Linux service and Interface

Can some assist me in creating a script that does this. Monitor Eth0 & Eth1 and httpd service. If interface Etho or Eth1 doesn't respond to pings for 5 minutes, the server should do a shutdown. Also if the httpd service isnt running or stopped for any reason shut the machine off. So basically any of these conditions will initiate a poweroff. Thanks

This is what ive done so far . Im still missing the ping section. Is what i'm doing correct?


Inter0=`/sbin/ifconfig | grep eth0 | awk '{print $1}'`
Inter1=`/sbin/ifconfig | grep eth1 | awk '{print $1}'`

if ps ax | grep -v grep | grep $SERVICE > /dev/null


echo "$SERVICE service running"


sleep 30s
shutdown -h now


if [ -z $inter0]; then
sleep 30s
shutdown -h now


if [ -z $Inter1]; then

sleep 30s
shutdown -h now


Last edited by duster; 7th October 2011 at 15:16.
Reply With Quote
Sponsored Links
Old 7th October 2011, 14:50
till till is offline
Super Moderator
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 37,015
Thanks: 840
Thanked 5,652 Times in 4,461 Posts

I think you could do this with monit and munin without having to create your own scripts. Falko has published several tutorials on that topic here on howtoforge. E.g. this one for debian:

Till Brehm
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting Email Working ISPConfig3 Squirrelmail and Courier etc Ian Wilson Installation/Configuration 17 19th June 2013 23:58
Virtual Users And Domains With Postfix, Courier, MySQL And SquirrelMail-Problema jz_ HOWTO-Related Questions 9 14th September 2011 14:31
First IP OK, second IP times out Craig Installation/Configuration 12 10th June 2011 11:40
ffmpeg Video support for ubuntu 7.10 [suphp-ispconfig] amaurib Installation/Configuration 13 16th February 2010 18:26
MyDNS startup problem valter General 9 20th June 2009 18:31

All times are GMT +2. The time now is 21:57.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.