A oneshot service runs to completion during startup. Dependents wait until it exits successfully — ideal for migrations, schema setup, or fixture loading.
# Run a oneshot migration to completion before the app starts.
processes:
- name: migrate
command: /usr/local/bin/migrate
args: ["-c", "echo migrated; exit 0"]
startup: oneshot
- name: app
command: /usr/local/bin/app
args: ["300"]
after: [migrate]
on-failure: shutdownstartup: oneshot—migrateruns once and must exit before dependents start.appdeclaresafter: [migrate], so it only starts oncemigrateexits 0.- A failing oneshot is fatal: gopherd exits rather than starting dependents.
migrateruns, printsmigrated, and exits 0.appthen starts and reportsrunning.gopherd status migratereportsstopped(it has already completed).
The placeholder migrate binary is replaced with /bin/sh so its args run as a script; app is replaced with /usr/bin/sleep. The test asserts status app is running (the gate opened) and that migrate is no longer running.
go test ./documentation/oneshot/ -v