head	1.5;
access;
symbols;
locks; strict;
comment	@# @;


1.5
date	99.08.08.03.22.46;	author dunc;	state Exp;
branches;
next	1.4;

1.4
date	98.07.26.10.23.13;	author dunc;	state Exp;
branches;
next	1.3;

1.3
date	98.06.10.00.01.23;	author dunc;	state Exp;
branches;
next	1.2;

1.2
date	98.06.09.23.06.41;	author dunc;	state Exp;
branches;
next	1.1;

1.1
date	98.06.09.22.17.12;	author dunc;	state Exp;
branches;
next	;


desc
@Script to ping a US host and log when it is unavailable
@


1.5
log
@Standard startup; address change (to apex mailer)
@
text
@#!/bin/sh
# $Id: pinger,v 1.4 1998/07/26 10:23:13 dunc Exp dunc $
# the next line is obeyed by sh but not expect \
exec expect -f "$0" -- "$@@"
# LATER - pick up host & log file names from command line
set fd [open pinger.log a+]
puts $fd "Log continued at [exec date -u]"
set timeout 60
while {1}  \
{
  spawn ping -nc1 203.37.38.13
  expect \
  {
    { 0% packet loss} {}
    { 100% packet loss} \
    {
      puts $fd "[exec date -u +%Y%m%d.%H%M%S] No response"
    }
    timeout \
    {
      puts $fd "[exec date -u +%Y%m%d.%H%M%S] ping timed out after 60 seconds"
    }
  } ;# expect
  flush $fd
  wait                             ;# For ping
  close -i $spawn_id               ;# Free the pty that spawn allocated
  exec sleep 60s                   ;# Delay until next try
} ;# while {1}
@


1.4
log
@Be sure to free the pty that spawn allocated
@
text
@d2 1
a2 1
# $Id: pinger,v 1.3 1998/06/10 00:01:23 dunc Exp dunc $
d4 1
a4 1
POSIXLY_CORRECT="";export POSIXLY_CORRECT;exec expect "$0" "$@@"
d11 1
a11 1
  spawn ping -nc1 129.122.150.81
@


1.3
log
@Flushes file
@
text
@d2 1
a2 1
# $Id: pinger,v 1.2 1998/06/09 23:06:41 dunc Exp dunc $
d26 1
@


1.2
log
@Works, but doesn't flush o/p to file
@
text
@d2 1
a2 1
# $Id: pinger,v 1.1 1998/06/09 22:17:12 dunc Exp dunc $
d24 1
@


1.1
log
@Initial revision
@
text
@d2 1
a2 1
# $Id: aftp,v 1.4 1998/06/09 22:01:38 dunc Exp $
d5 22
@
