Skip to content

Conversation

@parsa-fathi
Copy link

Auto Restart Service for Marzban

This PR introduces an automated restart feature for the Marzban service, designed to improve performance and memory management.

Key Changes:

  • Configurable Restart Schedule:
    • Users can set a specific time (hour/minute) for automatic restarts.
    • Input validation ensures hours (0–23) and minutes (0–59) are within valid ranges.
  • Clean Crontab Integration:
    • Updates the system’s crontab with the new schedule.
    • Removes old entries to avoid conflicts.
    • Restarts the cron service to apply changes immediately.
  • User Control:
    • Options to set, remove, or exit the restart configuration via an interactive menu.

Why This Matters:

Based on observed behavior, regular restarts of the Marzban container significantly reduce RAM usage over time, preventing memory leaks and maintaining stable performance. This is particularly useful for long-running instances where resource accumulation can degrade service reliability.

- **Auto Restart Service**:
  - Allows users to configure automatic restarts for the Marzban service.
  - Provides options to set the restart time (hour and minute), remove the configuration, or exit the menu.
  - Validates user inputs for hour (0-23) and minute (0-59).
  - Updates the system's crontab with the restart schedule and ensures proper cleanup of old entries.
  - Automatically restarts the cron service to apply changes.
@parsa-fathi parsa-fathi changed the title **Key Features Added:** **Auto Restart Service for Marzban** Apr 1, 2025
@parsa-fathi parsa-fathi changed the title **Auto Restart Service for Marzban** Auto Restart Service for Marzban Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant