systemg

Search docs

/
Install

Commands

purge

Remove systemg state and start fresh.

$ sysg purge

Warning

purge permanently deletes service history, logs, and runtime files. With no selector it wipes the entire state root. There is no undo.

Note

purge refuses to run while a live supervisor is still managing processes — wiping its state out from under it would strand those processes and corrupt the supervisor's view of the world. Stop the supervisor first, or pass --force.

error[SG0401]: refused to purge: a supervisor is still managing processes

  2 unit(s) are live under the running supervisor; purging its state now would strand them

  help:
    stop the supervisor first  sysg stop --supervisor
    then purge                 sysg purge
    or force it (stops + wipes) sysg purge --force

Options

ShortLongDescription
-c--configPurge only the projects this config declares (or __loose__ if it is project-less). Omit to wipe the whole state root
-p--projectPurge only this project's state
---forcePurge even while a supervisor is managing processes — stops it first, then wipes
-v--verbosePrint operation progress
---sysOpt into privileged system mode. Requires running as root
---drop-privilegesAccepted globally but ignored; purge does not spawn services
---plainDisable terminal decoration for automation
---log-levelSet logging verbosity for this invocation (trace through off, or 5-0)

Scope

Purge is deliberately explicit about what it deletes:

  • sysg purge — the whole state root: every project, the __loose__ bundle, logs, and the supervisor runtime files (socket, pid, config hint).
  • sysg purge -c <config> — only the projects that config declares. An unrelated project registered separately is left untouched.
  • sysg purge -p <project> — only that one project's state directory.

What gets removed

  • Service status history
  • Cron execution history
  • Log files (including system-mode logs at /var/log/systemg)
  • PID tracking files
  • Supervisor state
  • Socket and runtime files

When to use

  • After ungraceful shutdowns
  • To clear corrupted state
  • Before uninstalling systemg
  • To free disk space

Examples

Wipe everything

$ sysg purge
All systemg state has been purged

Purge one project

$ sysg purge -p arbitration
Purged state for project 'arbitration'

A -p naming a project with no state on disk refuses with SG0403 and deletes nothing.

A project id is one path segment. A -p that is empty, traversing, or absolute refuses with SG0404; a -c purge resolves every project the config declares before deleting any, so one bad target refuses the whole purge rather than leaving it half-done.

Force a purge while services are running

$ sysg purge --force
All systemg state has been purged

--force is the explicit "I accept the teardown" signal: it stops the live supervisor, kills its services, and removes the state.

See also

migrate-stateversion