24 lines
349 B
Python
Executable file
24 lines
349 B
Python
Executable file
#!/usr/bin/env python
|
|
# -*- Python -*-
|
|
|
|
# teste si notre sendmail fonctionne encore.
|
|
|
|
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,25)
|
|
data = s.recv(3)
|
|
OK = ("220" == data)
|
|
s.close()
|
|
except:
|
|
OK = 0
|
|
|
|
sys.exit(not OK)
|