.\"
.\" -*- nroff -*-
.\"
.\" Copyright (c) Thomas Andrews
.\"
.\" This program is free software: you can redistribute it and/or modify
.\" it under the terms of the GNU General Public License as published by
.\" the Free Software Foundation, either version 3 of the License, or
.\" (at your option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program. If not, see .
.\"
.TH LINKMON 1 "October 2009" Unix "User Manuals"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
.\" .nh disable hyphenation
.\" .hy enable hyphenation
.\" .ad l left justify
.\" .ad b justify to both left and right margins
.\" .nf disable filling
.\" .fi enable filling
.\" .BR insert line break
.\" .sp insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.SH NAME
linkmon \- Link Monitor
.SH SYNOPSIS
.B linkmon
.RI \-h\ HOST
.RI \-c\ COMMAND
.OP \-i\ INTERVAL
.OP \-n\ FAILURES
.OP \-t\ TIMEOUT
.OP \-d\ DEBUGLEVEL
.OP \-l\ SYSLOG_FACILITY
.SH DESCRIPTION
This program sends ICMP ECHO packets to the address of
your choice and then listens for ICMP REPLY packets.
If there's no response after the specified period it will retry repeatedly
until the specified count is reached, after which it will execute
the command specified. You can specify the period between pings
and also the number of failed attempts to make before running the command.
The syslog 'facility' can be set to a numerical value.
It doesn't daemonise - it is meant to be run from inittab.
It has to be run with UID 0 (ie root privileges)
\fIHOST\fP and COMMAND must be provided
\fICOMMAND\fP must be put into quotes if it has more than one argument
\fIINTERVAL\fP, \fIFAILURES\fP, \fITIMEOUT\fP, \fIDEBUGLEVEL\fP, and \fISYSLOG_FACILITY\fP are optional
\fIINTERVAL\fP defaults to 5 seconds between pings
\fITIMEOUT\fP defaults to 5 seconds (awaiting response)
\fIFAILURES\fP defaults to 5 attempts
\fIDEBUGLEVEL\fP defaults to level 2
\fISYSLOG_FACILITY\fP defaults to 24
.SH OPTIONS
A summary of options is included below.
.TP
.B \-d
Debug verbosity. The following levels can be specified:
.P
.ds a \t0 off
.ds b \t1 panic
.ds c \t2 error
.ds d \t3 warning
.ds e \t4 info
.ds f \t5 verbose
.ta 1i 2i
\*[a]
.br
\*[b]
.br
\*[c]
.br
\*[d]
.br
\*[e]
.br
\*[f]
.br
.TP
.B \-h
IP address of hostname to send ICMP echo requests to.
.TP
.B \-c
Command to run once after n consecutive failed attempts.
.TP
.B \-i
Interval (seconds) between attempts.
.TP
.B \-n
Number of consecutive failed attempts before running command.
.TP
.B \-t
Timeout per request.
.TP
.B \-l
Syslog facility level (numeric)
.SH EXAMPLES
.sp
linkmon -h 169.254.1.1 -c 'killall pppd'
.sp
linkmon -h 169.254.1.1 -c 'killall pppd' -n10 -t5 -i5 -d3
.SH SEE ALSO
fping(1)
.SH AUTHOR
Written by Thomas Andrews