ogcore/etc/systemd/system/og-mercure.service

28 lines
1011 B
INI

[Unit]
Description=Mercure Hub
After=network.target
Wants=network-online.target
[Service]
Type=simple
User=opengnsys
Group=opengnsys
WorkingDirectory=/opt/opengnsys/ogcore/
# Cargar variables de entorno desde archivo
EnvironmentFile=/opt/opengnsys/ogcore/etc/mercure/mercure-og.env
# Validar configuración antes de arrancar
ExecStartPre=/bin/sh -c '/usr/bin/mercure adapt -c /opt/opengnsys/ogcore/etc/mercure/mercure.orig.conf --envfile /opt/opengnsys/ogcore/etc/mercure/mercure-og.env > /opt/opengnsys/ogcore/etc/mercure/mercure.config'
ExecStartPre=/bin/sh -c '/usr/bin/mercure fmt --overwrite -c /opt/opengnsys/ogcore/etc/mercure/mercure.config'
# Iniciar y detener el servicio con la configuración generada
ExecStart=/usr/bin/mercure run -c /opt/opengnsys/ogcore/etc/mercure/mercure.config --envfile /opt/opengnsys/ogcore/etc/mercure/mercure-og.env
ExecStop=/usr/bin/mercure stop -c /opt/opengnsys/ogcore/etc/mercure/mercure.config
Restart=always
RestartSec=5s
[Install]
WantedBy=multi-user.target