Pollster does much quicker HTML updates now

This commit is contained in:
Neale Pickett 2009-10-09 08:55:51 -06:00
parent 93c9306ea5
commit fdf76ed847
2 changed files with 7 additions and 15 deletions

View File

@ -13,6 +13,8 @@ rotate /var/lib/ctf/scores.dat
rotate /var/lib/ctf/passwd
rm -f /var/lib/ctf/flags/* || true
sv restart /var/service/ctf
echo "Things you may want to tweak:"
find /var/lib/ctf/disabled
find /var/lib/kevin/tokens

View File

@ -2,6 +2,7 @@
import os
import re
import io
import sys
import time
import socket
@ -146,22 +147,9 @@ while True:
t_start = time.time()
# gather the list of IPs to poll
try:
ips = os.listdir(IP_DIR)
except Exception as e:
print('pollster: could not list dir %s (%s)' % (IP_DIR, e))
traceback.print_exc()
try:
os.remove(REPORT_PATH)
except Exception as e:
pass
try:
out = open(REPORT_PATH, 'w')
except Exception as e:
out = None
ips = os.listdir(IP_DIR)
out = io.StringIO()
out.write(config.start_html('Team Service Availability'))
for ip in ips:
# check file name format is ip
@ -213,6 +201,8 @@ while True:
out.write(config.end_html())
out.close()
open(REPORT_PATH, 'w').write(out.getvalue())
# sleep until its time to poll again
time.sleep(sleep_time)