Sponsored Content
Top Forums Shell Programming and Scripting Log of lost internet connections Post 303028686 by bakunin on Saturday 12th of January 2019 05:18:40 PM
Old 01-12-2019
Quote:
Originally Posted by drew77
I would like for it to only log pings that generate 100% packet loss. Thanks..

Code:
while true; do

date >> Internet_Connection_Log.txt
echo >> Internet_Connection_Log.txt
ping  47.182.239.232 -c 1 >> Internet_Connection_Log.txt
echo >> Internet_Connection_Log.txt
sleep 180
done

Make the logging dependent on the RC of ping:

Code:
while : ; do
     if ! ping  -c 1 47.182.239.232 ; then
          printf "\n%s\n" "ping failed at $(date)" >> Internet_Connection_Log.txt
     fi
     sleep 180
done

But wouldn't a log with start- and end-times of failures be better? Note that this makes sense only if the blocks of good and failing internet connections are longer - if it works 10 minutes, then fails for 10 minutes this would make sense, if every second ping fails but every other packet gets through this would create a very large log:

Code:
lFail=0
while : ; do
     if (( lFail )) ; then
          if ping  -c 1 47.182.239.232 ; then
               printf "\n%s\n" "ping worked again at $(date)" >> Internet_Connection_Log.txt
               lFail=0
          fi
     else
          if ! ping  -c 1 47.182.239.232 ; then
               printf "\n%s\n" "ping stopped working at $(date)" >> Internet_Connection_Log.txt
               lFail=1
          fi
     fi
     sleep 1
done

I hope this helps.

bakunin
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

dsl connections lost when attempting to retrieve mail from my server.

suse linux 6.4 im running and i have port 110 for pop and smtp open, i have set up some email addresses for my friends, but they recieve errors saying that relaying is denied. i know this is to prevent spamming software from using my domain to send spam, but how do i let my users send their mail?... (6 Replies)
Discussion started by: norsk hedensk
6 Replies

2. UNIX for Advanced & Expert Users

combining two internet connections

hey guys Do you guys know of a good way that I can combine and load balance my 2 Internet connections using a Linux or Bsd box? Would LVS be able to do this? Thanks in advance (1 Reply)
Discussion started by: arya6000
1 Replies

3. IP Networking

Lost Connectivity to the Internet

I'm running FreeBSD 6.2 and suddenly lost connectivity to the net. After unplugging the router and checking all the connections I could find nothing wrong. All the driver software seems to be intact. I thought I would remove the driver software and restore it. However, when I go to root and type ... (5 Replies)
Discussion started by: Aaron Van
5 Replies

4. IP Networking

Aggregate two internet connections

Hi I have a question related to load balancing.I have two separate internet connections with 2Mbps speed and i would like to aggregate this two connections intro one connection with 4Mbps.Is it possible to do that, to put a Linux or Unix machine as a gateway?I read some stuff to split the... (3 Replies)
Discussion started by: tafil
3 Replies

5. Ubuntu

Lost the log off, power down, etc. icon!

I had a purge of applications on my Ubuntu 8.10 install and lost the above mentioned icon from the toolbar, yes I know I should have left it alone! I have managed to find and install a shutdown icon and a separate shutdown, restart,etc icon uing the synaptic package manager but they are not the... (0 Replies)
Discussion started by: TonyFullerMalv
0 Replies

6. Windows & DOS: Issues & Discussions

42 UDP internet connections

First I had a problem: My internet was slow, now I know why, I have opened 42 connections to internet. What can I do? Thanks, YourDestinity (1 Reply)
Discussion started by: YourDestinity
1 Replies

7. IP Networking

Bonding Internet Connections

I’m familiar with load balancing.. but Is it possible to actually bond multiple DSL lines together? I hear of ways to bond using MLPPP but that requires support from an ISP. Is there a way to actually bond without support from my ISP, or use say a cable modem and a DSL line together for faster... (0 Replies)
Discussion started by: harley313
0 Replies

8. Red Hat

How to Multiple internet connections manage into a single connection.

Dear all, Hope you are all fine & enjoying your good health. Look at this equation 1+1+1=3 So simple I just want to say that I have three internet connections of 1mb, 1mb & 1mb but I can use only 1mb connection at a time & other two connections are useless for me. But now I want to make all... (0 Replies)
Discussion started by: saqlain.bashir
0 Replies

9. IP Networking

All incoming connections ips LOG

How to make a log that will log all ips that connect to the server or send packets? And how to block an ip that make packets flood and try to DDoS? Thanks. (1 Reply)
Discussion started by: [xEF]Danger
1 Replies
Git::Repository::Log::Iterator(3pm)			User Contributed Perl Documentation		       Git::Repository::Log::Iterator(3pm)

NAME
Git::Repository::Log::Iterator - Split a git log stream into records SYNOPSIS
use Git::Repository::Log::Iterator; # use a default Git::Repository context my $iter = Git::Repository::Log::Iterator->new('HEAD~10..'); # or provide an existing instance my $iter = Git::Repository::Log::Iterator->new( $r, 'HEAD~10..' ); # get the next log record while ( my $log = $iter->next ) { ...; } DESCRIPTION
"Git::Repository::Log::Iterator" initiates a git log command from a list of paramaters and parses its output to produce "Git::Repository::Log" objects represening each log item. METHODS
new( @args ) Create a new git log stream from the parameter list in @args and return a iterator on it. "new()" will happily accept any parameters, but note that "Git::Repository::Log::Iterator" expects the output to look like that of "--pretty=raw", and so will force the the "--pretty" option (in case "format.pretty" is defined in the Git configuration). Extra output (like patches) will be stored in the "extra" parameter of the "Git::Repository::Log" object. Decorations will be lost. When unsupported options are recognized in the parameter list, "new()" will "croak()" with a message advising to use "run( 'log' => ... )" to parse the output yourself. next() Return the next log item as a "Git::Repository::Log" object, or nothing if the stream has ended. AUTHOR
Philippe Bruhat (BooK), "<book at cpan.org>" COPYRIGHT
Copyright 2010 Philippe Bruhat (BooK), all rights reserved. LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2011-12-28 Git::Repository::Log::Iterator(3pm)
All times are GMT -4. The time now is 07:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy