the-sabra/zpm
Zig Process Manager
3aaeb0bf14935eabae118196f7949b404a42f8eamasterA lightweight process supervisor and daemon written in Zig for managing and monitoring multiple child processes.
Educational Project: This is a learning project exploring systems programming concepts in Zig including process management, IPC, and concurrent programming.
ZPM is a process supervisor similar to Supervisor or PM2. It runs as a daemon, managing child processes and automatically restarting them if they crash.
start, stop, status, logsCreate a config.toml file:
version = "0.1.0"
[[processes]]
name = "web-server"
command = "python3"
args = ["-m", "http.server", "8080"]
type = "web"
# Start daemon
./zig-out/bin/zpm start --config config.toml --foreground
# Check status
./zig-out/bin/zpm status
# Stop daemon
./zig-out/bin/zpm stop
# View logs
tail -f child0.stdout.log
/tmp/zpm.sock for CLI communicationsrc/
├── main.zig # CLI entry point
├── supervisor.zig # Process monitoring & restart
├── state.zig # Thread-safe state management
├── daemon.zig # Daemonization & PID handling
├── config.zig # TOML config parsing
└── ipc.zig # Unix socket IPC server
Omar Sabra (the-sabra)