daemon
Manage the Runix background daemon.
Subcommands
| Command | Description |
|---|---|
runix daemon start | Start the daemon in the background |
runix daemon stop | Stop the running daemon |
runix daemon status | Check if the daemon is running |
runix daemon restart | Restart the daemon |
runix daemon run | Run the daemon in the foreground |
daemon start
Start the daemon as a background process.
runix daemon start
Behavior
- Checks if a daemon is already running (via PID file + alive check)
- Forks a new process with
RUNIX_DAEMON=1environment variable - The daemon initializes:
- Creates
~/.runix/directory structure - Writes PID to
~/.runix/runix.pid - Creates Unix socket at
~/.runix/runix.sock - Loads
runix.yamlif found - Resurrects previously saved processes
- Creates
- Parent process waits for ready signal, then exits
File Paths
| File | Purpose |
|---|---|
~/.runix/runix.pid | Daemon process ID |
~/.runix/runix.sock | Unix socket for IPC |
daemon stop
Stop the running daemon gracefully.
runix daemon stop
Behavior
- Reads PID from
~/.runix/runix.pid - Sends SIGTERM to the daemon process
- Daemon handles shutdown:
- Stops all managed processes
- Removes socket and PID file
- Exits with code 0
daemon status
Report the daemon's status.
runix daemon status
Output:
Daemon is running (PID: 12345, Socket: /home/user/.runix/runix.sock)
Or:
Daemon is not running
daemon restart
Stop and start the daemon.
runix daemon restart
Equivalent to runix daemon stop && runix daemon start.
daemon run
Run the daemon in the foreground.
runix daemon run
Useful for:
- Debugging daemon behavior
- Running inside systemd (the
startupcommand generates unit files that usedaemon run) - Container environments
IPC Protocol
When the daemon is running, all CLI commands communicate via HTTP-over-Unix-socket:
POST / HTTP/1.1
Host: runix
Content-Type: application/json
{"action": "list", "payload": null}
See Daemon Architecture for the full protocol details.
What's Next
- Daemon Architecture — How the daemon works internally
- Startup Command — Install as system service
- Save/Resurrect — Persist process state