Tuesday, February 1, 2011

Re: [BLUG] Bad Weather? Geek Play Time

IIRC, ping is pretty easy to script. It supports a -c option to ping a certain number of times, and the return code is an indicator of success.

This means you should be able to do something like:

while true ; do
    if ! ping -c 1 $YOURHOST > /dev/null ; then
        mail -s "host $YOURHOST is down" $YOUREMAIL << /dev/null
    fi
done

This was just off the top of my head. YMMV. I've not double-checked man pages or tried running it.

I don't know about people with free time due to the weather. I mean, if we work with computers we can keep working as long as the power is up and if the power is down it means it is time to start eating the contents of the fridge...

Cheers,
Steven Black

On Tue, Feb 1, 2011 at 4:46 PM, Kirk Gleason <kgleason@gmail.com> wrote:
Yeah, I used to try the positive verification thing, but it is enough
try drive you to drink (now there's an idea ...)

Once when the power went out, I wrote a script (on an OS X system) to
say "X.X.X.X is now responding to a ping", and put it into an infinite
loop and then went to bed. Maybe what I should do is to write the
opposite of that script (have it do something when ping errors out),
and then have it make a call to Google voice to ring my cell phone if
the power goes out at work. Course it doesn't do any good if the power
at home is out.

Maybe something with Skype in a remote office ....

On Tue, Feb 1, 2011 at 4:07 PM, dosman <dosman@packetsniffers.org> wrote:
> You could use "positive verification" by having a system mail you
> every hour or 30 minutes that every thing's ok, but that gets annoying.
>
> I have a personal system that emails me each time it powers on so I
> know if it's been rebooted, but that only works because it is more
> likely to be rebooted than just powered off.
>
> -Nathan
>
> On Feb 1, 2011, at 3:45 PM, Kirk Gleason wrote:
>
>> Aside from the obvious, I'm trying to come up with creative ways to
>> let me know if we lose power at work. No external Nagios for me, so if
>> my mail server or firewall goes down before anything else, I get no
>> notice.
>>
>> On Tue, Feb 1, 2011 at 3:35 PM, Lord Drachenblut
>> <lord.drachenblut@gmail.com> wrote:
>>> so with the bad weather alot of people are at home today.
>>>
>>> So my question is what geek project are you working on today in
>>> this weather?
>>>
>>> --
>>> Mettle not in the Ways of dragons for thou art crunchy and taste good
>>> with ketchup
>>> _______________________________________________
>>> BLUG mailing list
>>> BLUG@linuxfan.com
>>> http://mailman.cs.indiana.edu/mailman/listinfo/blug
>>>
>>
>>
>>
>> --
>> Kirk Gleason
>> _______________________________________________
>> BLUG mailing list
>> BLUG@linuxfan.com
>> http://mailman.cs.indiana.edu/mailman/listinfo/blug
>
> _______________________________________________
> BLUG mailing list
> BLUG@linuxfan.com
> http://mailman.cs.indiana.edu/mailman/listinfo/blug
>



--
Kirk Gleason
_______________________________________________
BLUG mailing list
BLUG@linuxfan.com
http://mailman.cs.indiana.edu/mailman/listinfo/blug

No comments: