Day 2 Operations
How to start and keep Butler SOS running varies depending on whether you are using Docker or a native Windows/Linux/macOS binary.
Running Butler SOS with Docker
Starting Butler SOS using Docker is easy.
Initial Setup and Testing
First configure the docker-compose.yml file as needed, then start the Docker container in interactive mode (with output sent to the screen).
This is useful to ensure everything works as intended when first setting up Butler SOS.
docker compose upOnce Butler SOS has been verified to work as intended, hit Ctrl+C to stop it.
Production Mode
Then start it again in daemon (background) mode:
docker compose up -dFrom here on the Docker environment will make sure Butler SOS is always running, including restarting it if it for some reason stops, when server reboots etc.
Running Pre-built Standalone Binaries
Starting Butler SOS using the pre-built binaries could look like this on Windows:
d:
cd \node\butler-sos
butler-sos.exe --configfile butler-sos-prod.yaml --loglevel infoIt is of course also possible to put those commands in a command file (.bat on Windows, .sh etc on other platforms) and execute that file instead.
Running as a Service
As Butler SOS is the kind of service that (probably) should always be running on a server, it makes sense running it as a Windows service (or similar mechanism in Linux).
Windows
From version 15.4.0, Butler SOS installs itself as a Windows service, with all the benefits that follow (it starts with the server, is restarted if it stops, and can be monitored using operations tools):
.\butler-sos.exe --install-service -c C:\ButlerSOS\config\production.yaml --on-invalid-config waitFrom version 15.5.0, one server can run several Butler SOS services, for example one per Qlik Sense environment, each with its own name. See Windows service for both.
On earlier versions, use the excellent NSSM tool. A step-by-step tutorial for running Butler SOS as a Windows service using NSSM is available at ptarmiganlabs.com.
Linux: Using PM2 or Forever
On Linux both PM2 and Forever have been successfully tested with Butler SOS.
Stopping Butler SOS
Changed in 15.4.0
Before Butler SOS 15.4.0, Butler SOS ended at once on Ctrl+C or SIGTERM, with nothing in the log and an exit code other than 0.
When Butler SOS is told to stop, it says so in its log, says when it has stopped, and exits with code 0. That holds for every way of stopping it:
- Ctrl+C in a console window;
- the Windows service stopping it (see Running Butler SOS as a Windows Service), which sends Ctrl+C;
docker stop, Kubernetes, and systemd (systemctl stop), which send SIGTERM.
The last lines in the log, both on the console and in Butler SOS's own log file, are:
2026-11-29T08:39:17.626Z info: MAIN: Received SIGINT. Butler SOS is stopping.
2026-11-29T08:39:17.627Z info: MAIN: Butler SOS stopped cleanly.The signal named is SIGINT for Ctrl+C and SIGTERM for the others. Stopping takes well under a second.
It works the same when Butler SOS is waiting with a config file it cannot use (--on-invalid-config wait, see Staying up on an invalid config file).
A stop that comes before Butler SOS has finished starting is an interruption, not a clean stop. Butler SOS logs MAIN: Butler SOS stopped before it had finished starting. and exits with code 130 after Ctrl+C, or 143 after SIGTERM, as an interrupted command does. This matters most for --check-config: an interrupted check never exits 0, so a script can't mistake it for a config that passed.
What changed in 15.4.0
Before 15.4.0, Butler SOS ended at once on Ctrl+C or SIGTERM. Nothing in the log said it had been stopped rather than crashed, and the exit code was not 0.
Now:
- The log ends with the two lines above, so you can tell a stop from a crash.
- The exit code is 0. A service manager that restarts only on failure, such as systemd with
Restart=on-failureor Docker withrestart: on-failure, does not restart a Butler SOS that was stopped on purpose. docker stopis quicker. Butler SOS used to ignore SIGTERM inside its container, sodocker stopwaited its full 10 seconds and then killed it. Now Butler SOS exits as soon as it is asked, anddocker stop,docker compose downand container restarts finish in about a second.
What it does not do yet
Stopping does not yet write out data that Butler SOS holds in memory, or close its connections to InfluxDB, MQTT and other destinations first. Data that was waiting to be written when Butler SOS stopped is lost, as before. A full graceful shutdown is planned.
Monitoring Butler SOS
Butler SOS can be monitored via its uptime messages, Docker health checks, and metrics it publishes about itself.
The uptime monitor feature writes periodic messages to the console log and log files, indicating that Butler SOS is running.
It can also store its own memory usage in InfluxDB for visualization in Grafana dashboards.
Next Steps
After setting up operations, you might want to:
- Learn about upgrading Butler SOS
- Explore configuration options
- Review examples and dashboards