CronEdit...geht weiter
This commit is contained in:
parent
b1b941c82a
commit
39556f7613
3 changed files with 179 additions and 0 deletions
70
app.py
70
app.py
|
|
@ -912,6 +912,70 @@ def delete_word(category, word):
|
|||
return redirect(
|
||||
f"/categories/edit/{category}"
|
||||
)
|
||||
|
||||
def parse_cron_jobs(cron_jobs):
|
||||
|
||||
schedules = {}
|
||||
|
||||
for name, cron in cron_jobs.items():
|
||||
|
||||
schedules[name] = {
|
||||
"cron": cron,
|
||||
"minute": "",
|
||||
"hour": "",
|
||||
"interval": "",
|
||||
"days": []
|
||||
}
|
||||
|
||||
if (
|
||||
not cron
|
||||
or "Linux" in cron
|
||||
):
|
||||
continue
|
||||
|
||||
try:
|
||||
|
||||
minute, hour, day, month, weekday = (
|
||||
cron.split()
|
||||
)
|
||||
|
||||
schedules[name]["minute"] = minute
|
||||
|
||||
if hour.startswith("*/"):
|
||||
|
||||
schedules[name]["interval"] = (
|
||||
hour.replace(
|
||||
"*/",
|
||||
""
|
||||
)
|
||||
)
|
||||
|
||||
else:
|
||||
|
||||
schedules[name]["hour"] = hour
|
||||
|
||||
if "-" in weekday:
|
||||
|
||||
start, end = weekday.split("-")
|
||||
|
||||
schedules[name]["days"] = list(
|
||||
range(
|
||||
int(start),
|
||||
int(end) + 1
|
||||
)
|
||||
)
|
||||
|
||||
else:
|
||||
|
||||
schedules[name]["days"] = [
|
||||
int(weekday)
|
||||
]
|
||||
|
||||
except Exception:
|
||||
|
||||
pass
|
||||
|
||||
return schedules
|
||||
@app.route("/maintenance")
|
||||
def maintenance():
|
||||
|
||||
|
|
@ -922,11 +986,17 @@ def maintenance():
|
|||
""
|
||||
)
|
||||
cron_jobs = get_cron_jobs()
|
||||
|
||||
schedules = parse_cron_jobs(
|
||||
cron_jobs
|
||||
)
|
||||
print(schedules)
|
||||
return render_template(
|
||||
"maintenance.html",
|
||||
year=year,
|
||||
week=week,
|
||||
cron_jobs=cron_jobs,
|
||||
schedules=schedules,
|
||||
message=message
|
||||
)
|
||||
@app.route("/log")
|
||||
|
|
|
|||
|
|
@ -446,3 +446,18 @@ text-decoration: underline;
|
|||
text-align: right;
|
||||
width: 180px;
|
||||
}
|
||||
.weekday-selector {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.weekday-selector label {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.schedule-block {
|
||||
margin-top: 20px;
|
||||
padding-top: 15px;
|
||||
border-top: 1px solid #ddd;
|
||||
}
|
||||
|
|
@ -93,7 +93,55 @@
|
|||
<p>
|
||||
balance.py ausführen
|
||||
</p>
|
||||
<h3>Automatische Ausführung</h3>
|
||||
|
||||
<label>
|
||||
Minute:
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="number"
|
||||
min="0"
|
||||
max="59"
|
||||
name="balance_minute"
|
||||
value="7">
|
||||
|
||||
<br><br>
|
||||
|
||||
<label>
|
||||
Intervall:
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="number"
|
||||
min="1"
|
||||
max="24"
|
||||
name="balance_interval"
|
||||
value="4">
|
||||
|
||||
Stunden
|
||||
|
||||
<br><br>
|
||||
|
||||
<label>
|
||||
Tage:
|
||||
</label>
|
||||
|
||||
<br>
|
||||
|
||||
<input type="checkbox" checked> Mo
|
||||
<input type="checkbox" checked> Di
|
||||
<input type="checkbox" checked> Mi
|
||||
<input type="checkbox" checked> Do
|
||||
<input type="checkbox" checked> Fr
|
||||
<input type="checkbox" checked> Sa
|
||||
<input type="checkbox"> So
|
||||
|
||||
<br><br>
|
||||
|
||||
<button type="submit">
|
||||
Speichern
|
||||
</button>
|
||||
<form
|
||||
action="/run/balance"
|
||||
method="post">
|
||||
|
|
@ -139,7 +187,30 @@
|
|||
</button>
|
||||
|
||||
</form>
|
||||
<h3>Automatische Ausführung</h3>
|
||||
|
||||
<label>
|
||||
Uhrzeit:
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="time"
|
||||
name="transactions_time"
|
||||
value="23:07">
|
||||
|
||||
<br><br>
|
||||
|
||||
<input
|
||||
type="checkbox"
|
||||
checked>
|
||||
|
||||
Sonntag
|
||||
|
||||
<br><br>
|
||||
|
||||
<button type="submit">
|
||||
Speichern
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
|
|
@ -175,7 +246,30 @@
|
|||
</button>
|
||||
|
||||
</form>
|
||||
<h3>Automatische Ausführung</h3>
|
||||
|
||||
<label>
|
||||
Uhrzeit:
|
||||
</label>
|
||||
|
||||
<input
|
||||
type="time"
|
||||
name="categorize_time"
|
||||
value="23:37">
|
||||
|
||||
<br><br>
|
||||
|
||||
<input
|
||||
type="checkbox"
|
||||
checked>
|
||||
|
||||
Sonntag
|
||||
|
||||
<br><br>
|
||||
|
||||
<button type="submit">
|
||||
Speichern
|
||||
</button>
|
||||
</div>
|
||||
<div class="card">
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue