~ubuntu-branches/ubuntu/oneiric/ncbi-tools6/oneiric

« back to all changes in this revision

Viewing changes to doc/fwd_check.sh

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2008-07-14 19:43:15 UTC
  • mfrom: (2.1.12 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080714194315-ed44u9ek7txva2rz
Tags: 6.1.20080302-3
tools/readdb.c: enable madvise()-based code on all glibc (hence all
Debian) systems, not just Linux.  (Closes: #490437.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#! /bin/sh
2
 
# $Id: fwd_check.sh,v 1.27 2006/05/25 19:40:23 lavr Exp $
 
2
# $Id: fwd_check.sh,v 1.42 2008/02/27 17:19:43 lavr Exp $
3
3
# Author:   Denis Vakatov (vakatov@ncbi,nlm.nih.gov)
4
4
# Modified: Anton Lavrentiev (lavr@ncbi.nlm.nih.gov)
5
5
#
16
16
 
17
17
{
18
18
cat <<EOF
19
 
;130.14.22.1    5853    RETIRED
20
 
;130.14.22.2    5859    RETIRED
21
 
;130.14.22.8    5840    RETIRED
22
 
;130.14.22.30   5810    RETIRED
23
 
;130.14.22.31   5812    RETIRED
24
 
;130.14.22.32   5811    RETIRED
25
 
;130.14.22.12   5845    RETIRED
26
 
130.14.25.13    5555    INTERNAL
27
 
130.14.29.112   5860    OK
 
19
;130.14.25.13   5555    RETIRED
 
20
10.10.150.7     5555    INTERNAL
 
21
130.14.29.112   5860    RESERVED
28
22
130.14.29.112   5861    RESERVED
29
23
130.14.29.112   5862    RESERVED
30
24
130.14.29.112   5863    RESERVED
31
 
130.14.29.112   5864    RESERVED
32
 
130.14.29.112   5865    RESERVED
 
25
130.14.29.112   5864    OK
 
26
130.14.29.112   5865    OK
33
27
130.14.29.112   5866    RESERVED
34
28
130.14.29.112   5867    OK
35
29
130.14.29.112   5868    OK
36
30
130.14.29.112   5869    OK
37
 
130.14.29.112   5870    OK
 
31
130.14.29.112   5870    RESERVED
 
32
130.14.29.112   4444    RETIRED
 
33
130.14.29.112   4445    RESERVED
 
34
130.14.29.112   4446    RESERVED
 
35
130.14.29.112   4447    RESERVED
 
36
130.14.29.112   4448    OK
 
37
130.14.29.112   4449    OK
 
38
130.14.29.112   4450    RESERVED
 
39
130.14.29.112   4451    OK
 
40
130.14.29.112   4452    OK
 
41
130.14.29.112   4453    OK
 
42
130.14.29.112   4454    RESERVED
38
43
EOF
39
44
} |
40
45
while read x_host x_port x_status ; do
41
46
    test "`echo $x_host | grep -c '^[;]'`" != "0"  &&  continue
 
47
    if [ "$x_port" -lt "5860" -o "$x_port" -gt "5870" ]; then
 
48
        test -z "$HTTP_CAF" -o -n "$HTTP_CAF_EXTERNAL"  &&  continue
 
49
    fi
42
50
    if [ "$x_status" = "RETIRED"  -o \
43
 
         "$x_status" = "RESERVED" -o \
44
 
         "$x_status" = "READYING" ]; then
 
51
         "$x_status" = "RESERVED" ]; then
45
52
        echo "${x_host}:${x_port}       $x_status"
46
53
        continue
47
54
    fi
 
55
    test "$x_status" = "READYING"  &&  unset x_status
48
56
    ( echo ; sleep $delay_sec ) | telnet $x_host $x_port >/tmp/$$ 2>&1 &
49
57
    pid=$!
50
58
    trap 'rm -f /tmp/$$; kill $pid >/dev/null 2>&1' 1 2 15
52
60
    guard=$!
53
61
    wait $pid >/dev/null 2>&1
54
62
    kill $guard >/dev/null 2>&1
55
 
    grep -s 'NCBI Firewall Daemon:  Invalid ticket\.  *Connection closed\.' /tmp/$$ >/dev/null 2>&1
56
 
    if test $? -eq 0 ; then
57
 
        echo "${x_host}:${x_port}       ${x_status}"
 
63
    test -n "$HTTP_CAF_EXTERNAL"  || \
 
64
        cp="`tail +4 /tmp/$$ 2>/dev/null | grep -s '^[0-9]\{1,3\}[.][0-9]\{1,3\}[.][0-9]\{1,3\}[.][0-9]\{1,3\}:[0-9]\{1,5\}'`"
 
65
    grep -qs 'NCBI Firewall Daemon:  Invalid ticket\.  *Connection closed\.' /tmp/$$ >/dev/null 2>&1
 
66
    if   [ $? -eq 0 ]; then
 
67
        echo "${x_host}:${x_port}       ${x_status:-OKAY}${cp:+ }${cp}"
 
68
    elif [ -z "$x_status" ]; then
 
69
        echo "${x_host}:${x_port}       READYING"
58
70
    else
59
 
        echo "${x_host}:${x_port}       FAILED  ( telnet $x_host $x_port )"
 
71
        echo "${x_host}:${x_port}       FAILED  ( telnet $x_host $x_port )"
60
72
    fi
61
73
    rm -f /tmp/$$
62
74
done 2>&1 | grep -v 'Terminated'