Skip to main content

spawn

Dynamically create child processes from parent services. :::warning Deprecated sysg spawn is deprecated. Use sysg start --parent-pid <pid> --name <name> -- <command...>. :::
$ sysg spawn --name worker_1 -- python worker.py

Options

OptionDescription
--nameRequired. Unique identifier for spawned process
--ttlTime-to-live in seconds (optional)
--parent-pidParent process ID (defaults to caller’s parent PID if not specified)
--sysOpt into privileged system mode. Requires running as root
--log-levelOverride the logging verbosity for the spawned process

Examples

Preferred replacement with start

$ sysg start --parent-pid 12345 --name worker_1 -- python worker.py
$ 12345  # Returns PID

Spawn a worker process

$ sysg spawn --name worker_1 -- python worker.py
$ 12345  # Returns PID

Spawn with time limit

Process automatically terminates after 1 hour:
$ sysg spawn --name temp_worker \
  --ttl 3600 \
  -- ./process.sh

Spawn with parent PID tracking

$ sysg spawn --name api_worker \
  --parent-pid 12345 \
  -- node worker.js

Requirements

Parent service must be configured with:
services:
  orchestrator:
    command: "porki --role orchestrator --instructions instructions/INSTRUCTIONS.md"
    spawn:
      mode: dynamic
      limit: 10
The parent can then spawn up to 10 child processes dynamically.

See also