# Mosaic Discord connector, one instance per binding: mosaic-discord@. # Rendered by scripts/discord-service.sh from packages/discord/systemd/; # @REPO@ and @PATH@ are filled in at install time. Edit the template and # reinstall; do not edit the installed copy. [Unit] Description=Mosaic Discord connector (%i) Documentation=file://@REPO@/packages/discord/README.md After=network-online.target Wants=network-online.target StartLimitIntervalSec=600 StartLimitBurst=5 [Service] Type=simple WorkingDirectory=@REPO@ Environment=PATH=@PATH@ # A supervised run first clears a lock left by a crash or a reboot, and # refuses with exit 3 while STOP is present or the binding is held. Exit 3 # is never retried: the brake belongs to the operator. This happens inside # the main process on purpose: systemd honours RestartPreventExitStatus only # for the main process, so a refusing ExecStartPre would loop. ExecStart=@REPO@/scripts/discord.sh run %i --supervised Restart=on-failure RestartSec=15 RestartPreventExitStatus=3 # `systemctl --user stop` sends SIGTERM; the connector finishes the turn in # flight, then exits 0. The stop timeout covers the largest turn timeout a # binding may set (3600 s) plus margin; a normal stop takes seconds. KillSignal=SIGTERM KillMode=mixed TimeoutStopSec=3700 NoNewPrivileges=yes [Install] WantedBy=default.target