systemd
Unit files для relay и агентов
Relay (сервер)
ini
# /etc/systemd/system/flowlink.service [Unit] Description=FlowLink Relay After=network.target postgresql.service Wants=postgresql.service [Service] Type=simple User=root WorkingDirectory=/opt/flowlink ExecStart=/opt/flowlink/bin/flowlink relay --config /opt/flowlink/relay.json ExecStopPost=/bin/rm -f /run/flowlink.pid KillMode=mixed TimeoutStopSec=15 Restart=always RestartSec=5 [Install] WantedBy=multi-user.target
Agent (шаблон)
Template unit позволяет запускать несколько агентов:
ini
# /etc/systemd/system/[email protected] [Unit] Description=FlowLink Agent %i After=network.target Wants=flowlink.service [Service] Type=simple User=root WorkingDirectory=/opt/flowlink ExecStart=/opt/flowlink/bin/flowlink agent \ --config /opt/flowlink/agent/%i.json Restart=always RestartSec=5 [Install] WantedBy=multi-user.target
Управление
bash
# Запуск relay systemctl enable --now flowlink # Запуск агента systemctl enable --now flowlink-agent@my-server # Несколько агентов systemctl enable --now flowlink-agent@web-1 systemctl enable --now flowlink-agent@db-1 systemctl enable --now flowlink-agent@cache-1 # Статус systemctl status flowlink systemctl status flowlink-agent@my-server # Логи journalctl -u flowlink -f journalctl -u flowlink-agent@my-server -f