File: fping.monitor

package info (click to toggle)
mon 0.37h-3
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 336 kB
  • ctags: 72
  • sloc: perl: 2,167; sh: 138; makefile: 48
file content (57 lines) | stat: -rwxr-xr-x 1,424 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh
#
# Return a list of hosts which not reachable via ICMP echo
#
# Jim Trocki, trockij@transmeta.com
#
# $Id: fping.monitor,v 1.7 1998/01/18 17:40:01 trockij Exp $
#
#    Copyright (C) 1998, Jim Trocki
#
#    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 2 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, write to the Free Software
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
p=`which fping`
if [ ! -x "$p" ]
then
    echo fping.monitor error, could not find fping
    exit 1
fi

a=`fping -u -r 3 -t 2000 $*`
retval=$?

if [ "$retval" = 1 ]
then
    echo "$a" | tr ' ' '\n'  | sort | tr '\n' ' '
    exit $retval
fi

if [ "$retval" = 2 ]
then
    echo fping: no hosts found
    exit 1
fi

if [ "$retval" = 3 ]
then
    echo fping: invalid command line arguments
    exit 1
fi

if [ "$retval" = 4 ]
then
    echo fping: system call failure
    exit 1
fi