Start the scheduler daemon.
()
| 1397 | console.print(f"[red]Schedule not found: {schedule_id}[/red]") |
| 1398 | |
| 1399 | |
| 1400 | @schedule_app.command("run") |
| 1401 | def schedule_run( |
| 1402 | schedule_id: str = typer.Argument(..., help="Schedule ID to run now"), |
| 1403 | ): |
| 1404 | """Run a scheduled scan immediately.""" |
| 1405 | from modules.scheduler import ScanScheduler, ScheduleStorage |
| 1406 | |
| 1407 | scheduler = ScanScheduler() |
| 1408 | storage = ScheduleStorage() |
| 1409 | storage.attach_to_scheduler(scheduler) |
| 1410 | |
| 1411 | # Set up scan callback |
| 1412 | async def scan_callback(target: str, modules: list[str]): |
| 1413 | return _collect_scan_results(target, modules) |
| 1414 | |
| 1415 | scheduler.set_scan_callback(scan_callback) |
| 1416 | |
| 1417 | async def run(): |
| 1418 | job = await scheduler.run_now(schedule_id) |
| 1419 | if job: |
| 1420 | console.print(f"[green]Scan completed:[/green] {job.findings_count} findings") |
| 1421 | else: |
| 1422 | console.print(f"[red]Schedule not found: {schedule_id}[/red]") |
| 1423 | |
| 1424 | run_async(run()) |
| 1425 | |
| 1426 | |
| 1427 | @schedule_app.command("start") |
| 1428 | def schedule_start(): |
| 1429 | """Start the scheduler daemon.""" |
| 1430 | from modules.scheduler import ScanScheduler, ScheduleStorage |
| 1431 |
nothing calls this directly
no test coverage detected