mirror of https://github.com/dirtbags/moth.git
Pollster does much quicker HTML updates now
This commit is contained in:
parent
93c9306ea5
commit
fdf76ed847
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue