SSyncropel Docs

Windows Service

Run `spl serve` as a Windows Service so the instance starts at boot, survives logoff, and integrates with services.msc + the Event Log. Install, start, stop, uninstall, and troubleshooting.

On Linux and macOS, spl serve --daemon already detaches from the terminal, writes a PID file, and survives shell close, so a quick systemd or launchd unit is enough for boot-time autostart.

Windows needs something different. Console applications launched from PowerShell or CMD are bound to the session that started them and are torn down when the user logs off. The native supervisor on Windows is the Service Control Manager (SCM), the same thing that owns lsass, spooler, and every other background service listed in services.msc.

spl serve ships a Windows Service wrapper. Three flags drive the full lifecycle:

FlagWhat it doesAdmin required
--install-serviceRegister the instance with the SCM (default name SyncropelInstance)yes
--uninstall-serviceRemove the registration (stops the service first if running)yes
--serviceUsed by Windows when it starts the service. Do not run it yourself.n/a

Running spl serve in a window (--daemon or foreground) works exactly as on Unix. Operators who are happy running spl serve manually inside a PowerShell window don't need any of this.

Quickstart

From an elevated PowerShell (Run as Administrator):

# 1. Install: registers the service, creates the Event Log source
spl serve --install-service

# 2. Start: SCM invokes the binary; the service appears in services.msc
sc.exe start SyncropelInstance

# 3. Verify: /v1/capabilities responds, spl status shows the instance
curl http://127.0.0.1:9100/v1/capabilities
spl status

# 4. Stop: graceful shutdown (drains in-flight work)
sc.exe stop SyncropelInstance

# 5. Uninstall: removes SCM registration and Event Log source
spl serve --uninstall-service

After a successful install the service is configured with StartType = AutoStart, so it comes up at the next reboot without further intervention.

Customizing the service name

Multi-instance hosts (for example a test rig running three instances against three different SYNCROPEL_HOME directories) need three different SCM names. Pass --service-name on every flag:

spl serve --install-service  --service-name SyncropelInstance_dev
sc.exe start SyncropelInstance_dev
sc.exe stop  SyncropelInstance_dev
spl serve --uninstall-service --service-name SyncropelInstance_dev

Names must be 1..256 characters and cannot contain slashes, control characters, or leading / trailing whitespace. The CLI validates before calling the SCM so an invalid name fails fast with a clear message rather than an opaque Win32 error.

How it works

The service runs the same spl.exe you use interactively. --install-service tells Windows to start it with serve --service --service-name <name> every time. Do not run the --service flag yourself.

A stop from Windows (sc.exe stop <name>, or the stop button in Services) shuts the instance down cleanly, the same as Ctrl+C on Unix: in-flight work finishes, the store is saved, and the process exits with code 0.

Event Log

Install registers an Event Log source whose name matches the service name. Lifecycle events (start, stop, unexpected exits) land in Event Viewer → Windows Logs → Application filtered by Source = SyncropelInstance (or your --service-name override).

From PowerShell:

Get-EventLog -LogName Application -Source SyncropelInstance -Newest 20

For deeper diagnostics the instance's own tracing output still writes to %USERPROFILE%\.syncro\logs\spl.log. The Event Log is the place to look when the instance failed to start at boot or was killed by the OS; the tracing log is the place to look when the instance is running but something inside it is misbehaving.

Troubleshooting

"Access is denied" on install / uninstall

You're not running as Administrator. Open PowerShell via "Run as administrator" and retry. The SCM rejects CreateService / DeleteService / OpenService(SERVICE_ALL_ACCESS) from a non-elevated token.

Service registered, but sc.exe start returns error 1053

Error 1053 means "service did not respond to the start or control request in a timely fashion." Most common causes:

  1. Port 9100 already in use: another spl serve is already listening. Run spl status from a regular shell to see the existing instance, then stop it first.
  2. Missing first sign-in setup: if auth.required = true and no service account is set up for the instance's default user, the start-up check fails. Stop the service, run interactively with spl serve --insecure-localhost once to mint a recovery token, then restart the service.
  3. Binary path changed: the service remembers the .exe path from install time. If you moved or reinstalled spl.exe, the service still points at the old path. Fix: spl serve --uninstall-service → move / reinstall → spl serve --install-service.

The tracing log at %USERPROFILE%\.syncro\logs\spl.log carries the first-error detail every time. Check it before escalating.

--install-service says "already installed but points at a different binary"

You moved spl.exe (or installed a new build to a different path) without uninstalling first. Run spl serve --uninstall-service --service-name <name> to clear the stale registration, then --install-service again. The error is deliberate: silently overwriting the service registration would hide which binary is actually running.

sc.exe stop hangs

The service reports StopPending to SCM and then runs the same graceful-shutdown path as Ctrl+C on Unix. Shutdown can take a few seconds while in-flight work finishes and the store is saved. If it hasn't stopped after ~30 seconds, the service may be hung. Use sc.exe queryex <name> to read the PID and kill it forcibly:

sc.exe queryex SyncropelInstance
taskkill /F /PID <pid>

Then check the log at %USERPROFILE%\.syncro\logs\spl.log; a stuck stop is worth reporting.

Uninstall says "service is marked for deletion"

The SCM flags the service for deletion when you call DeleteService while the process is still alive. Reboot or stop the service fully before running --uninstall-service again. The wrapper tries to stop the service synchronously before deleting, so this only surfaces if a stop hangs past the 10-second wait.

Comparison to Unix

CapabilityUnix (systemd / launchd)Windows Service
Detach from terminalspl serve --daemon detaches itself--install-service; Windows owns the process
Start at bootsystemd unit / launchd plist--install-service sets AutoStart
Survive logoffyes (via systemd)yes (SCM session 0)
Graceful shutdownSIGTERMWindows stop request, same clean shutdown
View in UIsystemctl statusservices.msc
Lifecycle logjournaldEvent Log (Application, source = service name)

Everything else behaves the same no matter how the instance was started.

On this page