write a systemd unit for the daemon instead of the sysv script
"INSTALL.sh system" wrote a script into /etc/init.d. On debian 13 that
script is never run: the sysv compatibility generator of systemd is gone,
so nothing turns it into a service and nothing starts it at boot.
Where systemd is in charge the action now writes <name>.service in Etc,
beside the nginx and nftables files, and leaves /etc/init.d alone; without
systemd it installs the sysv script exactly as before. The unit is only
written, and the run prints the three commands that install it, as for the
other generated files.
What the unit had to get right, both found by running the daemon:
- -d. Without it the daemon keeps stdin in its select set, and stdin
being /dev/null under systemd it reads EOF at once and exits with 22
(sac-a-push.phh, the branch that returns 22). The sysv script got away
without it because screen gave the daemon a tty.
- KillSignal stays SIGTERM. On SIGTERM the daemon serializes the room
into <legal_path>/brisk-crystal.data and exits 0, and the next start
reads it back, so a stop and a start keep the games. SIGINT exits with
1 and saves nothing.
Restart=on-failure, so a stop asked for stays stopped while a crash comes
back up; TimeoutStopSec=15, measured against the 56ms an empty room takes
to serialize; ExecReload sends SIGHUP, which the daemon already treats as
a reload; WorkingDirectory because the daemon reaches its own files by
relative paths. The screen session and the shell loop that respawned the
daemon are both gone, and its output goes to the journal, which the unit
says how to silence.
ngx_put is now gen_put: it is no longer only for nginx files.
Checked in a container with systemd: the unit passes systemd-analyze
verify, the service starts and binds the eleven ports, systemctl reload
reaches the daemon without changing its pid, systemctl stop exits 0 in
50ms leaving brisk-crystal.data behind, the next start logs "ROOM FROM
FILE", and a SIGKILL on the main process brings it back up (NRestarts=1).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>