Stop the daemon gracefully. Returns: True if daemon was stopped, False otherwise
()
| 509 | |
| 510 | |
| 511 | def stop_daemon() -> bool: |
| 512 | """Stop the daemon gracefully. |
| 513 | |
| 514 | Returns: |
| 515 | True if daemon was stopped, False otherwise |
| 516 | """ |
| 517 | if not is_daemon_running(): |
| 518 | print("Daemon is not running") |
| 519 | return False |
| 520 | |
| 521 | # Create shutdown signal file |
| 522 | shutdown_file = DAEMON_DIR / "shutdown.signal" |
| 523 | shutdown_file.touch() |
| 524 | |
| 525 | # Wait for daemon to exit |
| 526 | print("Stopping daemon...") |
| 527 | for _ in range(10): |
| 528 | if not is_daemon_running(): |
| 529 | print("✅ Daemon stopped") |
| 530 | return True |
| 531 | time.sleep(1) |
| 532 | |
| 533 | print("⚠️ Daemon did not stop gracefully") |
| 534 | return False |
| 535 | |
| 536 | |
| 537 | def get_daemon_status() -> dict[str, Any]: |
no test coverage detected