LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 11-27-2004, 01:27 AM   #1
ritme909
Member
 
Registered: Nov 2004
Location: Washington DC
Distribution: Debian, LFS, FC2
Posts: 43

Rep: Reputation: 15
Notifying Users of Downtime


Hi, first of all let me apologize for asking a question that has probably been answered before, unfortunately I'm not sure where to look for the solution.

I am running a dedicated qmail server for the purpose of learning how to run a mail server. I have been running the server for a few months now without any major problems. However, occasionally my connection goes down, which is inevitable since I use ADSL. I was wondering if there is any way to automatically notify users of unplanned downtime?

So hypothetically my system tries to ping another computer outside of my LAN at 1:00, it doesn't respond, my system logs the time and continues to try and ping the external computer at 1 minute intervals. At 1:15 my computer succeeds in pinging another computer outside of the LAN, it logs this time then emails all of my users that the mail server was down from 1:00-1:15.

Is there a program/script to do this? Also it would be great if it could let my users know how many emails they theoretically missed. It could take an average of how many messages that user received in the past few months during that time frame and let them know how many messages they MAY have missed during the downtime.

Any suggestions for my problem, or suggestions on what web page/book I should read would be greatly appreciated. Thanks in advance...

-- ritme909
 
Old 11-27-2004, 09:25 AM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
I'm sure you could script something like that quite easilly. I haven't tried it but this should work:
Code:
#!/bin/bash
# Change this to the internet IP to check
IP="ip.of.internet.host"

ping -c1 $IP 2>&1 > /dev/null

if [ $? -eq 0 ] && [ -f /tmp/downdate ];then
 echo "Connection went down at `cat /tmp/downdate` came back up at `date`" | mail you@domain.com -s "Connection status"
 rm -f /tmp/downdate
elif [ $? -ne 0 ] && [ ! -f /tmp/downdate ];then
 date > /tmp/downdate
fi
To be honest I wouldn't worry, if your connection is down then a mailserver will just retry the delivery and no messages should be lost.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LQ Downtime jeremy LQ Suggestions & Feedback 18 11-14-2004 02:48 PM
yoper.com downtime caulktel Yoper 1 10-30-2004 04:49 PM
Recent Downtime jeremy LQ Suggestions & Feedback 4 11-20-2003 11:21 AM
LinuxQuestions.org Downtime jeremy LQ Suggestions & Feedback 1 11-02-2003 11:47 PM
Sorry for the downtime jeremy LQ Suggestions & Feedback 0 01-06-2001 12:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration