#373 Package upgrades start the enabled mail worker again (#371)
–
- github
- github/openchronology/timeline-app
- github/openchronology/timeline-app#373
- pull request
- state:merged
Fixes #371 An upgrade stops the server and the mail worker; `openchronology-migrate` started only the server, so an enabled mail worker stayed down and account email waited in `oc_mail_outbox`. **Debian and RPM** (`deploy/debian-server/openchronology-migrate`, which the RPM also ships): after restarting the server, `systemctl is-enabled --quiet openchronology-mail.service && systemctl restart openchronology-mail.service`, printing "OpenChronology mail worker restarted." A disabled worker stays stopped; `--no-restart` still restarts nothing. `postinst` and the RPM's `openchronology-setup` do the same where they restart the server. **FreeBSD**: the upgrade stops `openchronology_mail` too; `openchronology-migrate` now restarts it when it is enabled. **Homebrew**: upgrades don't stop the agent, but it keeps running the old version; `openchronology-migrate` restarts the mail agent when it is loaded. **Windows**: the installer already restarted an Automatic `OpenChronologyMail`; `openchronology-migrate.cmd` now does too (and still fails if the server's restart fails). **Compose**: `docs/docker.md` says to recreate `mail-worker` with the app. **Tests**: `test/server-mail-upgrade.mjs`, used by `server-deb.mjs` and `server-rpm.mjs`. The containers have no systemd, so a stand-in `systemctl` (with `/run/systemd/system`) keeps the units' enabled state and runs the mail worker as its unit would (with a placeholder Resend key; the outbox is empty). It checks that the upgrade stops the enabled worker, that `openchronology-migrate` starts it and it stays up, that `--no-restart` starts nothing, and that a disabled worker stays stopped. The FreeBSD, Homebrew and Windows tests check that their workers, which are not enabled, are not restarted. **Docs**: README.Debian, README.RPM, README.FreeBSD, README.Homebrew, README.Windows.txt, the deploy READMEs and an "Upgrading" note in `docs/administration.md`. Local: `node test/server-deb.mjs` (debian13) and `node test/server-rpm.mjs` (fedora44) pass on freshly built packages, and `npm test` passes (361/361). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_011fFY8eruEi1xAkkMBni13B https://github.com/openchronology/timeline-app/pull/373
Related
- #371 Package upgrades leave the mail worker stopped
- #374 Package upgrades leave the syslog and journald importers stopped
- #375 openchronology-migrate restarts the enabled syslog and journald importers after an upgrade
- openchronology-migrate restarts the enabled syslog and journald importers after an upgrade
- Merge pull request #373 from openchronology/fix/371-mail-worker-restart
Open #373 Package upgrades start the enabled mail worker again (#371) in the timeline