Skip to content

Running a service

A service is a command that should keep running: a queue worker, a bot, a small server. RunWisp starts it with the daemon and starts it again when it exits.

runwisp.toml
[services.worker]
instances = 3 # keep three copies running
run = "node /app/worker.js"

Run runwisp reload and the three copies start.

Terminal window
runwisp logs -f worker

Each line starts with the copy it came from (worker#2 | ...). Every start of a copy is a run in the history, so when one crashes, its output and exit code stay behind for you to read.

If the command exits on its own when it’s done, it’s a task. If it runs until you stop it, it’s a service. A script that loops forever with a sleep inside is usually better as a task on a schedule; see A polling loop.

A service that exits right after it starts is restarted with a growing delay. After too many failed starts in a row, RunWisp stops trying and alerts you like a failed task. See When a service can’t start.