Script to make sure CSC looks operational
This commit is contained in:
commit
b8301408c9
|
@ -0,0 +1,7 @@
|
|||
CSC-Status
|
||||
-------------
|
||||
|
||||
A simple set of shell scripts to make sure CSC stuff is up.
|
||||
|
||||
./run calls all the shell scripts in tests.d and prints stuff when a failure is
|
||||
encountered. Best run as a cron job.
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
fail=0
|
||||
|
||||
for i in "`dirname $0`"/tests.d/*; do
|
||||
$i || fail=1
|
||||
done
|
||||
|
||||
[[ $fail -eq 0 ]] || (echo "Failures encountered"; exit 1)
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys, socket
|
||||
|
||||
services = [
|
||||
('caffeine.csclub.uwaterloo.ca', [22, 25, 80, 110, 143, 143, 443, 465, 587, 993, 995]),
|
||||
('artificial-flavours.csclub.uwaterloo.ca', [22, 389, 636]),
|
||||
('taurine.csclub.uwaterloo.ca', [22]),
|
||||
('natural-flavours.csclub.uwaterloo.ca', [22]),
|
||||
('mirror.csclub.uwaterloo.ca', [21, 22, 80, 873]),
|
||||
('denardo.csclub.uwaterloo.ca', [22]),
|
||||
('corn-syrup.csclub.uwaterloo.ca', [22]),
|
||||
('ascorbic-acid.csclub.uwaterloo.ca', [21, 22, 53, 80, 81, 443, 8000, 8080]), #all ssh
|
||||
('ginseng.csclub.uwaterloo.ca', [22, 111, 389, 464, 636, 749, 888, 2049]),
|
||||
('webauth.csclub.uwaterloo.ca', [22, 443]),
|
||||
('wiki.csclub.uwaterloo.ca', [80, 443]),
|
||||
]
|
||||
|
||||
for S in services:
|
||||
try:
|
||||
host = socket.gethostbyname(S[0])
|
||||
for port in S[1]:
|
||||
s = socket.socket()
|
||||
s.connect( (host , port) )
|
||||
s.close()
|
||||
except socket.error, e:
|
||||
print "FAIL socket connect to ", S, e
|
||||
sys.exit(1)
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
curl -s "https://csclub.uwaterloo.ca" > /dev/null || (echo "FAIL on csc" && exit 2)
|
||||
curl -s "https://webauth.csclub.uwaterloo.ca" > /dev/null || (echo "FAIL on webauth" && exit 3)
|
||||
curl -s "https://mail.csclub.uwaterloo.ca" > /dev/null || (echo "FAIL on mail" && exit 4)
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env python
|
||||
import urllib2, sys
|
||||
|
||||
pages=["https://csclub.uwaterloo.ca", "http://mirror.csclub.uwaterloo.ca"]
|
||||
|
||||
for page in pages:
|
||||
try:
|
||||
r = urllib2.urlopen(page, timeout=3)
|
||||
page = r.read()
|
||||
if not len(page) > 1000:
|
||||
print "FAIL, didn't have enough data"
|
||||
sys.exit(2)
|
||||
if not"Computer Science Club" in page:
|
||||
print "FAIL, homepage doesn't mention Computer Science Club"
|
||||
sys.exit(3)
|
||||
# So read() didn't throw an exception, nor did opening,
|
||||
# and we have enough data, so likely good.
|
||||
sys.exit(0)
|
||||
except urllib2.URLError as e:
|
||||
print "FAIL, exception ", e
|
||||
sys.exit(1)
|
Loading…
Reference in New Issue