Repository navigation
wsw 0.10.0 adds what real-world services need: a graceful stop, restart policies, environment variables, dependencies, any service account and a configuration file. It is still a single static executable, and one command line still installs a service.
wsw install --name Redmine --exe C:\Redmine\ruby\bin\ruby.exe --working-dir C:\Redmine\redmine `
--env RAILS_ENV=production --env "PATH=C:\Redmine\ruby\bin;%PATH%" `
--depends-on RedminePostgreSQL --start-type delayed-auto `
--account-name "NT AUTHORITY\NetworkService" --grant-dir C:\Redmine\redmine `
--restart on-failure --restart-delay 10 --stop-timeout 20 `
--log-dir C:\Redmine\logs --log-max-size 10 --max-log-files 8 `
-- C:\Redmine\ruby\bin\bundle exec puma -e production -b tcp://0.0.0.0:3000New features
- Direct start:
--exe <path> -- <args...>starts the executable withoutcmd.exe, so there are nocmd.exequoting rules to deal with and the real exit code is reported.--cmdis still supported. - Graceful stop: on stop and on system shutdown, the process receives Ctrl+C (or
--stop-cmdis run instead). wsw waits up to--stop-timeoutseconds (default 15) before killing the process tree. - Restart policies:
--restart always|on-failure|never;--restart-delay, with exponential backoff up to--restart-max-delay;--reset-afterand--max-restarts;- native SCM recovery actions with
--scm-failure-actionsand--scm-failure-reset.
- Environment:
--env KEY=VALUEand--env-file.%VAR%references are expanded when the service starts. - Service settings:
--depends-on;--start-type auto|delayed-auto|manual|disabled;--display-nameand--description.
- Accounts:
LocalSystem,LocalService,NetworkService, virtual accounts (NT SERVICE\name) and gMSA (DOMAIN\name$) need no password.--grant-logon-rightgrants the "Log on as a service" right, and--grant-dirgrants write access to a directory. - Logs:
--log-dir;- size based rotation with
--log-max-size; - stderr in a separate file with
--log-split(wsw logs --stderr).
- Hooks:
--pre-start,--post-stopand--hook-timeout. - Configuration file:
wsw install --config service.tomlreads the options from a TOML file whose keys are named like the flags. - Management:
wsw updatechanges an installed service without reinstalling it. A failed update restores the previous configuration.wsw status --verboseshows the effective configuration.
The README has a table that maps every WinSW XML element to the matching wsw option.
Fixes
- The SCM is now told about the real state of the service (
StartPending,Running,StopPendingwith checkpoints) and about its real exit code, so Windows recovery actions can kick in. - A process that keeps crashing is restarted with backoff instead of every second.
- The output of the process is now logged line by line: lines and UTF-8 characters split across two reads are no longer garbled.
- Child processes can no longer escape the Job Object, so the whole process tree is stopped together with the service.
- Every command exits with a non-zero code when it fails, and
restartalso starts a service that was stopped.
Upgrading from 0.9.x
- Services installed by 0.9.x keep running after the binary is replaced, and every 0.9.x command line still works.
wsw update --name <service>migrates an old service to the new configuration storage, which lives in the registry under the service key.- Behaviour changes:
- On stop the process first receives Ctrl+C. A process that ignores it is killed after 15 seconds instead of immediately.
- Restarts after a crash slow down progressively, up to one every 60 seconds.
wsw runin a terminal now supervises the process exactly like the service does, until you press Ctrl+C.