mirror of https://github.com/Aidaho12/haproxy-wi
parent
3885b281b7
commit
f91f329308
14
app/jobs.py
14
app/jobs.py
|
@ -1,6 +1,8 @@
|
||||||
import os
|
import os
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
|
import distro
|
||||||
|
|
||||||
from app import scheduler
|
from app import scheduler
|
||||||
import app.modules.db.sql as sql
|
import app.modules.db.sql as sql
|
||||||
import app.modules.roxywi.roxy as roxy
|
import app.modules.roxywi.roxy as roxy
|
||||||
|
@ -64,3 +66,15 @@ def delete_old_logs():
|
||||||
os.remove(curpath)
|
os.remove(curpath)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f'error: cannot delete old log files: {e}')
|
print(f'error: cannot delete old log files: {e}')
|
||||||
|
|
||||||
|
|
||||||
|
@scheduler.task('interval', id='update_owner_on_log', hours=12, misfire_grace_time=None)
|
||||||
|
def update_owner_on_log():
|
||||||
|
log_path = get_config.get_config_var('main', 'log_path')
|
||||||
|
try:
|
||||||
|
if distro.id() == 'ubuntu':
|
||||||
|
os.system(f'sudo chown www-data:www-data -R {log_path}')
|
||||||
|
else:
|
||||||
|
os.system(f'sudo chown apache:apache -R {log_path}')
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
|
@ -66,9 +66,9 @@
|
||||||
<th style="width: 15%;">{{lang.words.Hostname}}</th>
|
<th style="width: 15%;">{{lang.words.Hostname}}</th>
|
||||||
<th style="width: 5%;">{{lang.words.port|title()}}</th>
|
<th style="width: 5%;">{{lang.words.port|title()}}</th>
|
||||||
<th style="width: 5%;">{{lang.words.enabled|title()}}</th>
|
<th style="width: 5%;">{{lang.words.enabled|title()}}</th>
|
||||||
<th style="width: 11%;">Telegram</th>
|
<th style="width: 15%;">Telegram</th>
|
||||||
<th style="width: 11%;">Slack</th>
|
<th style="width: 15%;">Slack</th>
|
||||||
<th style="width: 11%;">PagerDuty</th>
|
<th style="width: 15%;">PagerDuty</th>
|
||||||
<th style="width: 10%;">{{lang.words.group|title()}}</th>
|
<th style="width: 10%;">{{lang.words.group|title()}}</th>
|
||||||
<th style="width: 100%;">{{lang.words.desc|title()}}</th>
|
<th style="width: 100%;">{{lang.words.desc|title()}}</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
|
|
|
@ -1640,8 +1640,8 @@ function editList(list, color) {
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
function saveList(action, list, color) {
|
function saveList(action, list, color) {
|
||||||
var serv = $( "#serv-"+color+"-list option:selected" ).val();
|
var serv = $("#serv-" + color + "-list option:selected").val();
|
||||||
if(!checkIsServerFiled($("#serv-"+color+"-list"))) return false;
|
if (!checkIsServerFiled($("#serv-" + color + "-list"))) return false;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/app/add/haproxy/bwlist/save",
|
url: "/app/add/haproxy/bwlist/save",
|
||||||
data: {
|
data: {
|
||||||
|
|
|
@ -693,7 +693,8 @@ $( function() {
|
||||||
try {
|
try {
|
||||||
var cur_path = window.location.pathname;
|
var cur_path = window.location.pathname;
|
||||||
var attr = $(this).attr('href');
|
var attr = $(this).attr('href');
|
||||||
if (cur_path == '/app/add/haproxy' || cur_path == '/app/add/nginx' || cur_path == '/app/servers' || cur_path == '/app/admin' || cur_path == '/app/install') {
|
if (cur_path == '/app/add/haproxy' || cur_path == '/app/add/nginx' || cur_path == '/app/servers' ||
|
||||||
|
cur_path == '/app/admin' || cur_path == '/app/install' || cur_path == '/app/runtimeapi') {
|
||||||
if (typeof attr !== typeof undefined && attr !== false) {
|
if (typeof attr !== typeof undefined && attr !== false) {
|
||||||
$('title').text($(this).attr('title'));
|
$('title').text($(this).attr('title'));
|
||||||
history.pushState({}, '', $(this).attr('href'));
|
history.pushState({}, '', $(this).attr('href'));
|
||||||
|
|
Loading…
Reference in New Issue