26 lines
390 B
Python
Executable file
26 lines
390 B
Python
Executable file
#!/usr/bin/env python
|
|
# -*- Python -*-
|
|
|
|
# teste si notre squid fonctionne encore (sortof).
|
|
|
|
from socket import *
|
|
import sys
|
|
|
|
OK = 0
|
|
|
|
host = "localhost"
|
|
if len(sys.argv) > 1:
|
|
host = sys.argv[1]
|
|
|
|
s = socket(AF_INET,SOCK_STREAM)
|
|
try:
|
|
s.connect(host,3128)
|
|
s.send("GET squid-vit-il")
|
|
data = s.recv(4)
|
|
OK = ("HTTP" == data)
|
|
s.close()
|
|
except:
|
|
OK = 0
|
|
|
|
sys.exit(not OK)
|
|
|