Skip to main content

Hello World

Minimal systemg service.

Configuration

version: "1"
logs:
  sink: file
  max_bytes: 10485760
  max_files: 3
status:
  snapshot_mode: summary
  snapshot_interval_secs: 5
services:
  counter:
    command: "sh counter.sh"

Script

#!/bin/sh
$ i=1
$ while true; do
$     echo "Count: $i"
$     i=$((i + 1))
$     sleep 1
$ done

Run it

$ sysg start
$ sysg logs --service counter
$ sysg stop
You’ll see:

The example keeps `logs.sink: file` explicit so `sysg logs` works immediately.
For high-volume services, use `logs.sink: none` and rely on your normal logging
pipeline.

`status.snapshot_mode: summary` keeps status and inspect reads inexpensive by
reading current persisted state without detailed runtime process collection.
Count: 1
Count: 2
Count: 3

Next steps

Add a restart policy to handle crashes:
version: "1"
logs:
  sink: file
  max_bytes: 10485760
  max_files: 3
status:
  snapshot_mode: summary
  snapshot_interval_secs: 5
services:
  counter:
    command: "sh counter.sh"
    restart_policy: "always"