2017-11-16 12:14:17 +01:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
|
|
|
# Execute every 5 min, 2 mins after alfred comes in (sleep 120 in cron)
|
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__) + '/' + '..'))
|
|
|
|
|
|
|
|
from ffmap.routertools import *
|
|
|
|
from ffmap.maptools import *
|
|
|
|
from ffmap.mysqltools import FreifunkMySQL
|
2018-01-10 23:39:43 +01:00
|
|
|
from ffmap.stattools import record_global_stats, record_hood_stats, record_gw_stats
|
2018-11-30 18:52:51 +01:00
|
|
|
from ffmap.hoodtools import update_hoods_v2
|
2017-11-16 12:14:17 +01:00
|
|
|
|
|
|
|
import time
|
|
|
|
start_time = time.time()
|
|
|
|
|
|
|
|
mysql = FreifunkMySQL()
|
|
|
|
detect_offline_routers(mysql)
|
2017-11-15 20:33:31 +01:00
|
|
|
detect_orphaned_routers(mysql)
|
2017-11-16 12:14:17 +01:00
|
|
|
delete_orphaned_routers(mysql)
|
|
|
|
#delete_old_stats(mysql) # Only execute once daily, takes 2 minutes
|
2018-08-27 19:16:47 +02:00
|
|
|
update_hoods_v2(mysql)
|
2017-11-16 12:14:17 +01:00
|
|
|
record_global_stats(mysql)
|
|
|
|
record_hood_stats(mysql)
|
2018-01-10 23:39:43 +01:00
|
|
|
record_gw_stats(mysql)
|
2017-11-16 12:14:17 +01:00
|
|
|
update_mapnik_csv(mysql)
|
|
|
|
mysql.close()
|
|
|
|
|
2017-12-10 20:09:40 +01:00
|
|
|
print("--- %.3f seconds ---" % (time.time() - start_time))
|