feat: script jobs scheduler and manager page for Fortigate, UniFi and Grandstream scripts

This commit is contained in:
Carlos Tello
2026-08-17 00:20:03 -03:00
parent f3b6d8ef71
commit 8b2260bf14
13 changed files with 2122 additions and 6 deletions
+29
View File
@@ -0,0 +1,29 @@
import sqlite3
import os
DB_PATH = os.path.join(os.path.dirname(__file__), "onever_drive.db")
def seed():
conn = sqlite3.connect(DB_PATH)
cursor = conn.cursor()
jobs = [
("Respaldo de FortiGate API", "python", "app/scripts/backup_fortigate.py", "0 6,18 * * *"),
("Respaldo de UniFi Controller", "python", "app/scripts/backup_unifi.py", "0 3 * * *"),
("Respaldo de Grandstream UCM/GWN", "python", "app/scripts/backup_grandstream.py", "0 1 * * *")
]
for name, stype, path, cron in jobs:
cursor.execute("SELECT id FROM script_jobs WHERE script_path = ?", (path,))
if not cursor.fetchone():
cursor.execute(
"INSERT INTO script_jobs (name, script_type, script_path, schedule_cron, is_active, created_at) VALUES (?, ?, ?, ?, 1, CURRENT_TIMESTAMP)",
(name, stype, path, cron)
)
print(f"Seeded script job: {name}")
conn.commit()
conn.close()
if __name__ == "__main__":
seed()