Fix wrong finish staus on status.json
This commit is contained in:
parent
f826952327
commit
ec4bd696e1
@ -65,7 +65,7 @@
|
|||||||
|
|
||||||
|
|
||||||
//Refresh periode in seconds
|
//Refresh periode in seconds
|
||||||
var refresh = 15;
|
var refresh = 10;
|
||||||
var done = false;
|
var done = false;
|
||||||
function status(){
|
function status(){
|
||||||
$.getJSON("/status.json", function(data) {
|
$.getJSON("/status.json", function(data) {
|
||||||
@ -79,7 +79,8 @@ function status(){
|
|||||||
done = false;
|
done = false;
|
||||||
}else{
|
}else{
|
||||||
$('tbody').append('<td>'+val.status+'</td>');
|
$('tbody').append('<td>'+val.status+'</td>');
|
||||||
done = true;
|
|
||||||
|
done = data.finish;
|
||||||
}
|
}
|
||||||
$('#table-design').append('</tr>');
|
$('#table-design').append('</tr>');
|
||||||
});
|
});
|
||||||
|
@ -63,7 +63,7 @@ def read_config():
|
|||||||
backup.read_ini_file(config_file)
|
backup.read_ini_file(config_file)
|
||||||
|
|
||||||
backup_sections = SECTIONS or []
|
backup_sections = SECTIONS or []
|
||||||
|
|
||||||
all_sections = [backup_item.backup_name for backup_item in backup.backup_list]
|
all_sections = [backup_item.backup_name for backup_item in backup.backup_list]
|
||||||
if not backup_sections:
|
if not backup_sections:
|
||||||
backup_sections = all_sections
|
backup_sections = all_sections
|
||||||
@ -71,7 +71,7 @@ def read_config():
|
|||||||
for b in backup_sections:
|
for b in backup_sections:
|
||||||
if not b in all_sections:
|
if not b in all_sections:
|
||||||
raise Exception('Section %s is not defined in config file' % b)
|
raise Exception('Section %s is not defined in config file' % b)
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
if not backup_sections:
|
if not backup_sections:
|
||||||
sections = [backup_item.backup_name for backup_item in backup.backup_list]
|
sections = [backup_item.backup_name for backup_item in backup.backup_list]
|
||||||
@ -170,7 +170,7 @@ def check_usb_disk():
|
|||||||
if "tisbackup" in os.popen("/sbin/dumpe2fs -h %s 2>&1 |/bin/grep 'volume name'" % usb_partition).read().lower():
|
if "tisbackup" in os.popen("/sbin/dumpe2fs -h %s 2>&1 |/bin/grep 'volume name'" % usb_partition).read().lower():
|
||||||
flash("tisbackup backup partition found: %s" % usb_partition)
|
flash("tisbackup backup partition found: %s" % usb_partition)
|
||||||
tisbackup_partition_list.append(usb_partition)
|
tisbackup_partition_list.append(usb_partition)
|
||||||
|
|
||||||
print tisbackup_partition_list
|
print tisbackup_partition_list
|
||||||
|
|
||||||
if len(tisbackup_partition_list) ==0:
|
if len(tisbackup_partition_list) ==0:
|
||||||
@ -222,14 +222,14 @@ def check_mount_disk(partition_name, refresh):
|
|||||||
@app.route('/status.json')
|
@app.route('/status.json')
|
||||||
def export_backup_status():
|
def export_backup_status():
|
||||||
exports = dbstat.query('select * from stats where TYPE="EXPORT" and backup_start>="%s"' % mindate)
|
exports = dbstat.query('select * from stats where TYPE="EXPORT" and backup_start>="%s"' % mindate)
|
||||||
return jsonify(data=exports)
|
return jsonify(data=exports,finish= ( len(os.listdir(spooler)) == 0 ))
|
||||||
|
|
||||||
@app.route('/backups.json')
|
@app.route('/backups.json')
|
||||||
def last_backup_json():
|
def last_backup_json():
|
||||||
exports = dbstat.query('select * from stats where TYPE="BACKUP" ORDER BY backup_start DESC ')
|
exports = dbstat.query('select * from stats where TYPE="BACKUP" ORDER BY backup_start DESC ')
|
||||||
return Response(response=json.dumps(exports),
|
return Response(response=json.dumps(exports),
|
||||||
status=200,
|
status=200,
|
||||||
mimetype="application/json")
|
mimetype="application/json")
|
||||||
|
|
||||||
|
|
||||||
@app.route('/last_backups')
|
@app.route('/last_backups')
|
||||||
@ -244,16 +244,18 @@ def export_backup():
|
|||||||
backup_dict = read_config()
|
backup_dict = read_config()
|
||||||
sections = []
|
sections = []
|
||||||
for backup_types in backup_dict:
|
for backup_types in backup_dict:
|
||||||
|
if backup_types == "null_list":
|
||||||
|
continue
|
||||||
for section in backup_dict[backup_types]:
|
for section in backup_dict[backup_types]:
|
||||||
if section.count > 0:
|
if section.count > 0:
|
||||||
sections.append(section[1])
|
sections.append(section[1])
|
||||||
|
|
||||||
noJobs = ( len(os.listdir(spooler)) == 0 )
|
noJobs = ( len(os.listdir(spooler)) == 0 )
|
||||||
if "start" in request.args.keys() or not noJobs:
|
if "start" in request.args.keys() or not noJobs:
|
||||||
start=True
|
start=True
|
||||||
if "sections" in request.args.keys():
|
if "sections" in request.args.keys():
|
||||||
backup_sections = request.args.getlist('sections')
|
backup_sections = request.args.getlist('sections')
|
||||||
|
|
||||||
else:
|
else:
|
||||||
start=False
|
start=False
|
||||||
cp.read(tisbackup_config_file)
|
cp.read(tisbackup_config_file)
|
||||||
@ -277,13 +279,13 @@ def raise_error(strError, strInfo):
|
|||||||
global error, info
|
global error, info
|
||||||
error = strError
|
error = strError
|
||||||
info = strInfo
|
info = strInfo
|
||||||
|
|
||||||
def cleanup():
|
def cleanup():
|
||||||
if os.path.isdir(spooler):
|
if os.path.isdir(spooler):
|
||||||
print "cleanup ", spooler
|
print "cleanup ", spooler
|
||||||
rmtree(spooler)
|
rmtree(spooler)
|
||||||
os.mkdir(spooler)
|
os.mkdir(spooler)
|
||||||
|
|
||||||
@spool
|
@spool
|
||||||
def run_export_backup(args):
|
def run_export_backup(args):
|
||||||
#Log
|
#Log
|
||||||
@ -296,12 +298,12 @@ def run_export_backup(args):
|
|||||||
|
|
||||||
# Main
|
# Main
|
||||||
logger.info("Running export....")
|
logger.info("Running export....")
|
||||||
|
|
||||||
if args['backup_sections']:
|
if args['backup_sections']:
|
||||||
backup_sections = args['backup_sections'].split(",")
|
backup_sections = args['backup_sections'].split(",")
|
||||||
else:
|
else:
|
||||||
backup_sections = []
|
backup_sections = []
|
||||||
|
|
||||||
backup = tis_backup(dry_run=False,verbose=True,backup_base_dir=args['base'])
|
backup = tis_backup(dry_run=False,verbose=True,backup_base_dir=args['base'])
|
||||||
backup.read_ini_file(args['config_file'])
|
backup.read_ini_file(args['config_file'])
|
||||||
mount_point = args['mount_point']
|
mount_point = args['mount_point']
|
||||||
@ -315,4 +317,4 @@ cleanup()
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
read_config()
|
read_config()
|
||||||
app.debug=True
|
app.debug=True
|
||||||
app.run(host='0.0.0.0',port=8000, debug=True)
|
app.run(host='0.0.0.0',port=8000, debug=True)
|
Loading…
Reference in New Issue
Block a user