Skip to main content

daemon

Manage the Runix background daemon.

Subcommands​

CommandDescription
runix daemon startStart the daemon in the background
runix daemon stopStop the running daemon
runix daemon statusCheck if the daemon is running
runix daemon restartRestart the daemon
runix daemon runRun the daemon in the foreground

daemon start​

Start the daemon as a background process.

runix daemon start

Behavior​

  1. Checks if a daemon is already running (via PID file + alive check)
  2. Forks a new process with RUNIX_DAEMON=1 environment variable
  3. The daemon initializes:
    • Creates ~/.runix/ directory structure
    • Writes PID to ~/.runix/runix.pid
    • Creates Unix socket at ~/.runix/runix.sock
    • Loads runix.yaml if found
    • Resurrects previously saved processes
  4. Parent process waits for ready signal, then exits

File Paths​

FilePurpose
~/.runix/runix.pidDaemon process ID
~/.runix/runix.sockUnix socket for IPC

daemon stop​

Stop the running daemon gracefully.

runix daemon stop

Behavior​

  1. Reads PID from ~/.runix/runix.pid
  2. Sends SIGTERM to the daemon process
  3. 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 startup command generates unit files that use daemon 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​