# server-monitor configuration

# How often to check for active connections (seconds)
check_interval: 180

# Number of consecutive idle checks before shutdown is triggered
# This prevents shutdown from brief disconnects
# Example: with check_interval=180 and grace_checks=10, shutdown after 30 minutes idle
grace_checks: 10

# Command to run when shutting down the server
shutdown_command: "sudo suspend now"

# List of ports to monitor
# Shutdown triggers only when ALL ports have zero established connections
# or are not listening (if check_listening is enabled)
ports:
  - 22    # SSH – someone is logged in
  - 3000  # your app port

# Optional: Consider a port active if it has a listening server (not just established connections)
# Useful for servers that accept intermittent connections
# Default: true
# check_listening: true

# Optional: Telegram notifications
# Events notified: monitor start, idle detected, connection restored, shutdown
# notify:
#   telegram:
#     bot_token: "123456:ABC-your-bot-token"
#     chat_id: "your-chat-id"

# Optional: scripts to run automatically at server boot (sutils startup)
# Each script is registered as a systemd one-shot service.
# scripts:
#   - name: setup-env
#     run: /home/ubuntu/setup-env.sh
#     # user: ubuntu
#
#   - name: start-app
#     run: /home/ubuntu/start-app.sh
#     # user: ubuntu
