source: trunk/lvs/debian/config/etc/ha.d/ldirectord-http.sh @ 2051

Last change on this file since 2051 was 2051, checked in by mitchb, 12 years ago
Work around ipvsadm not knowing how to filter on fwmark We're already using awk to process our output; let it do all the work.
  • Property svn:executable set to *
File size: 676 bytes
Line 
1#!/bin/bash
2
3ulimit -v 10240
4
5# Read and ignore the request
6line=foo
7while [ -n "$line" ]; do
8    read line
9    line=${line%[:blank:]}
10    line=${line%
11}
12done
13
14# Generate an HTTP reply
15
16echo "HTTP/1.0 200 OK
17"
18echo "Content-type: text/html
19"
20echo "
21"
22echo "<html><head><title>scripts.mit.edu server status</title></head><body><h1>scripts.mit.edu server status</h1><p>The following table shows a list of the servers that are currently handling web requests for scripts.mit.edu:</p><table>"
23/sbin/ipvsadm | sed 's/:0//; s/:Port//' | awk 'BEGIN { OFS="</td><td>" } /^FWM  2 /,/^FWM  [^2] / { if (/->/) print "<tr><td>" $2, $4, $5, $6 "</td></tr>"}'
24echo "</table></body></html>"
Note: See TracBrowser for help on using the repository browser.