Skip to content

fghj daemon

Terminal window
fghj daemon start
fghj daemon stop
fghj daemon restart
fghj daemon status

fghjd itself is meant to run for the life of the machine — started at boot and restarted on crash by whatever supervises it (systemd, a launchd LaunchDaemon, or just a terminal you leave open during local dev). None of these subcommands stop or start that process. Instead they talk to its always-on control API to toggle whether it’s active (serving ports 80/443 on its loopback alias, answering *.fghj.internal DNS, and maintaining /etc/hosts) or idle (staying up and reachable, but out of the way).

Tells fghjd to go idle:

  1. Stops and drops the DNS server and the HTTP/HTTPS reverse proxy, freeing ports 80/443, its loopback alias, and the DNS socket.
  2. Removes the OS DNS routing it set up for its zones (fghj.internal, fghj.raw.internal) and every currently-active wildcard_hosts suffix: the /etc/resolver files it authored on macOS, the fghj0 link on Linux.
  3. Clears fghj’s managed block from /etc/hosts, dropping every additional host alias.
  4. Tears down the raw zone’s host-side plumbing — the listeners and loopback aliases that make a *.fghj.raw.internal address reachable from the host (see Networking: HTTP vs. raw).

fghjd keeps running and keeps serving its control API the whole time — this is why no sudo is needed for it, unlike the old kill-based version of this command.

Docker containers fghjd was fronting are not stopped — they keep running under Docker’s own supervision and are simply unreachable via *.fghj.internal, *.fghj.raw.internal, or any additional host until the next start. Container-to-container traffic is unaffected either way — that goes through Docker’s own per-network DNS, which fghjd isn’t in the path of.

If fghjd isn’t running at all, this just prints fghjd is not running and exits cleanly.

This is a durable instruction, not a one-shot action: fghjd persists an idle_requested flag in its on-disk state (/var/lib/fghjd/daemon-state.json) so that if it crashes or the machine reboots before you run start again, it comes back up idle instead of silently reactivating behind your back. Only an explicit fghj daemon start clears that flag.

Reverses stop: re-adds the loopback alias, rebinds DNS and the 80/443 proxy, reinstalls the OS resolver config, and resyncs /etc/hosts from whatever’s currently running. Safe to call when already active — it’s a no-op in that case.

Because fghjd’s reconciler already re-derives all of this state from live Docker containers and on-disk workspace metadata on every tick (see Run lifecycle & registry), start doesn’t need fghjd to remember what it was doing before stop — it just reconciles fresh, the same way it would after an ungraceful crash. It also clears the idle_requested flag described above, so a later crash/reboot restart comes back active again.

Trusting the CA isn’t part of start: fghj wire does that the first time, and fghj doctor --fix does it if trust is ever lost.

Equivalent to stop followed by start. It doesn’t restart the fghjd process: that’s the service manager’s job (sudo brew services restart fghj on macOS, sudo systemctl restart fghjd on Linux).

Reports whether fghjd is reachable at all, and if so, whether it’s currently active or idle.

fghjd only exits in response to a real termination signal (SIGTERM/ SIGINT) — e.g. sudo brew services stop fghj, launchctl bootout, sudo systemctl stop fghjd, a service uninstall, or system shutdown. On that path it still runs the same deactivation as fghj daemon stop first, so it never leaves stale ports, resolver config, or /etc/hosts entries behind for whatever starts next.