mirror of
https://github.com/FreifunkFranken/fff-monitoring.git
synced 2024-06-17 04:44:25 +02:00
Adrian Schmutzler
7955e60f2f
scripts/defragtables.py: - If run without argument, all tables EXCEPT stats are defragmented (quick run) - If run with argument e.g. "1", all table INCLUDING stats are defragmented (will take about one hour) scripts/defragtable.py <space-separated list of tables>: - Defragments the specified tables; will crash if table does not exist Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
23 lines
458 B
Python
Executable File
23 lines
458 B
Python
Executable File
#!/usr/bin/python3
|
|
|
|
# Execute manually
|
|
|
|
import os
|
|
import sys
|
|
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__) + '/' + '..'))
|
|
|
|
from ffmap.misc import defrag_all
|
|
from ffmap.mysqltools import FreifunkMySQL
|
|
|
|
import time
|
|
start_time = time.time()
|
|
|
|
mysql = FreifunkMySQL()
|
|
if(len(sys.argv)>1):
|
|
defrag_all(mysql,sys.argv[1])
|
|
else:
|
|
defrag_all(mysql,False)
|
|
mysql.close()
|
|
|
|
print("--- Total defrag duration: %.3f seconds ---" % (time.time() - start_time))
|