# Systemd Services & Timers Inventory - srv759970.hstgr.cloud
# Generated: 2025-12-09T17:45:00Z
# DEEP AUDIT - All custom systemd units

metadata:
  generated_at: "2025-12-09T17:45:00Z"
  server: srv759970.hstgr.cloud
  custom_services: 15
  custom_timers: 6
  pm2_processes: 3

# =============================================================================
# CUSTOM SYSTEMD SERVICES (non-standard)
# =============================================================================
custom_services:
  # Infrastructure Services
  - name: docker-autostart.service
    description: Docker container auto-start on demand
    status: running
    enabled: true
    location: /opt/docker-autostart/
    documented: true
    category: infrastructure

  - name: nginx-auto-docker.service
    description: Auto-start Docker containers on Nginx request
    status: running
    enabled: true
    script: /usr/local/bin/nginx-auto-docker-v3.sh
    documented: false
    category: infrastructure

  - name: mcp-nodejs.service
    description: MCP Server (Node.js)
    status: running
    enabled: true
    location: /var/www/mcp-servers/
    port: 3100
    documented: false
    category: ai_services
    recommendation: "ADD to registry.yml"

  - name: mcp-python.service
    description: MCP Server (Python)
    status: running
    enabled: true
    location: /var/www/mcp-servers/
    port: 3101
    documented: false
    category: ai_services
    recommendation: "ADD to registry.yml"

  - name: ollama.service
    description: Ollama Local LLM
    status: inactive
    enabled: false
    port: 11434
    documented: true
    category: ai_services
    note: "Started on demand"

  - name: rag-anything.service
    description: RAG Anything API
    status: inactive
    enabled: false
    location: /opt/rag-anything/
    port: 8010
    documented: partially
    category: ai_services
    note: "Started on demand"

  - name: ragflow.service
    description: RAGFlow full stack
    status: inactive
    enabled: false
    location: /opt/ragflow/
    port: 9500
    documented: partially
    category: ai_services
    note: "Multi-container stack"

  - name: rclone-music-mount.service
    description: Mount OneDrive music folder via rclone
    status: running
    enabled: true
    script: /opt/scripts/mount-onedrive-music.sh
    mount_point: /mnt/onedrive-music
    documented: false
    category: storage
    recommendation: "Document in storage section"

  - name: fail2ban.service
    description: Intrusion prevention
    status: running
    enabled: true
    documented: true
    category: security

  # Standard but notable services
  - name: docker.service
    description: Docker Engine
    status: running
    enabled: true
    documented: true
    category: infrastructure

  - name: nginx.service
    description: Nginx reverse proxy
    status: running
    enabled: true
    documented: true
    category: infrastructure

  - name: mysql.service
    description: MySQL server (native, not Docker)
    status: running
    enabled: true
    documented: true
    category: database

  - name: php8.3-fpm.service
    description: PHP-FPM for native WordPress
    status: running
    enabled: true
    documented: partially
    category: web

  - name: postfix.service
    description: Mail Transfer Agent
    status: running
    enabled: true
    documented: false
    category: system
    recommendation: "Document mail configuration"

  - name: unattended-upgrades.service
    description: Automatic security updates
    status: running
    enabled: true
    documented: false
    category: system

# =============================================================================
# SYSTEMD TIMERS
# =============================================================================
timers:
  # Custom timers
  - name: cleanup-rd-torrents.timer
    description: Cleanup broken RealDebrid torrents
    schedule: "daily"
    service: cleanup-rd-torrents.service
    script: /home/automation/scripts/cleanup-broken-torrents.sh
    documented: false
    category: media_stack

  - name: ollama-idle-stop.timer
    description: Stop Ollama when idle
    schedule: "every 5 minutes"
    service: ollama-idle-stop.service
    script: /root/scripts/ollama-idle-stop.sh
    documented: false
    category: ai_services
    recommendation: "Move script to /opt/scripts/"

  - name: docker-autostart-cleanup.timer
    description: Cleanup idle containers
    schedule: "every 15 minutes"
    documented: true
    category: infrastructure

  # Standard system timers
  - name: certbot.timer
    description: Auto-renew SSL certificates
    schedule: "twice daily"
    documented: true
    category: security
    note: "Let's Encrypt auto-renewal"

  - name: apt-daily.timer
    description: Daily apt update
    schedule: "daily"
    documented: false
    category: system

  - name: apt-daily-upgrade.timer
    description: Daily apt upgrade
    schedule: "daily"
    documented: false
    category: system

  - name: logrotate.timer
    description: Log rotation
    schedule: "daily"
    documented: false
    category: system

  - name: man-db.timer
    description: Man page database update
    schedule: "daily"
    documented: false
    category: system

  - name: fstrim.timer
    description: SSD TRIM
    schedule: "weekly"
    documented: false
    category: system

# =============================================================================
# PM2 PROCESSES
# =============================================================================
pm2_processes:
  user: automation
  processes:
    - name: incluzhact
      script: /var/www/incluzhact/server.js
      status: online
      port: 3050
      mode: fork
      documented: false
      recommendation: "ADD to registry.yml"

    - name: incluzhact-preview
      script: /var/www/incluzhact/server-preview.js
      status: online
      port: 3051
      mode: fork
      documented: false
      recommendation: "Consider merging with main"

    - name: jokers-hockey
      script: /var/www/jokers/server.js
      status: online
      port: 3060
      mode: fork
      documented: partially
      recommendation: "Verify documentation"

# =============================================================================
# SERVICES TO ADD TO REGISTRY
# =============================================================================
undocumented_services:
  high_priority:
    - mcp-nodejs (port 3100)
    - mcp-python (port 3101)
    - incluzhact (PM2, port 3050)
    - incluzhact-preview (PM2, port 3051)

  medium_priority:
    - rclone-music-mount.service
    - postfix.service (mail config)
    - cleanup-rd-torrents.timer

  low_priority:
    - ollama-idle-stop.timer (move script first)
    - unattended-upgrades.service

# =============================================================================
# SUMMARY
# =============================================================================
summary:
  custom_services_running: 10
  custom_services_stopped: 3
  custom_timers: 6
  system_timers: 5
  pm2_processes: 3

  undocumented:
    services: 5
    timers: 3
    pm2: 2

  recommendations:
    - "ADD MCP servers (nodejs, python) to registry.yml"
    - "ADD PM2 processes (incluzhact, jokers) to registry.yml"
    - "DOCUMENT mail configuration (postfix)"
    - "MOVE ollama-idle-stop.sh from /root/scripts/ to /opt/scripts/"
    - "CREATE systemd service documentation page"
