Lifecycle

Clean startup, graceful shutdown, and orphan process cleanup.

Graceful Shutdown

When you press q in the TUI or send SIGINT/SIGTERM, fuku performs a graceful shutdown — stopping services in reverse tier order so that dependent services stop before their dependencies.

fuku
 received signal: SIGINT

 stopping tier edge
    web         stopping  SIGTERM → pid 76780
    web         stopped

 stopping tier platform
    api         stopping  SIGTERM → pid 76758
    worker      stopping  SIGTERM → pid 76759
    worker      stopped
    api         stopped

 stopping tier foundation
    auth        stopping  SIGTERM → pid 76741
    auth        stopped

 all services stopped

Shutdown Sequence

  1. Services stop in reverse tier order (edge → platform → foundation)
  2. Each service receives SIGTERM first
  3. If the service doesn't exit within the timeout, SIGKILL is sent
  4. Within a tier, services stop concurrently

Pre-flight Cleanup

Before starting services, fuku automatically checks for orphaned processes from previous runs. This prevents port conflicts and zombie processes — common issues when a previous fuku session crashed or was killed with kill -9.

fuku run default
$ fuku run default

 preflight  scanning service directories...
 preflight  found stale process api pid 75210
 preflight  found stale process worker pid 75211
 preflight  killed 2 orphaned processes
 preflight  done

 tier foundation
    auth        running

Pre-flight checks each service directory for leftover PID files and kills any stale processes before starting fresh. This runs automatically — no configuration needed.

Ready to try it out?

Get Started