Skip to content

Maintenance Commands

These commands handle diagnostics, upgrades, recovery, and lifecycle operations.

Which diagnostic command to use?

  • Use safecall system status for a quick passive snapshot (service/cron/monit/CLI wiring).
  • Use safecall system selftest for runtime health validation (mode-aware checks).
  • Use safecall system doctor for guided remediation (migration/update/repair prompts).

safecall system status

Shows operational status for service, monit, cron update job, and CLI symlink.

Usage

bash
sudo ./util.sh system status

Use this first when validating deployment health.

safecall system selftest

Runs deployment health checks.

Usage

bash
sudo ./util.sh system selftest

What is checked

  • required files (safecall, util.sh, util.ts, config)
  • checksum integrity (checksums.json) when present
  • config validity and expected keys
  • version alignment (/version vs version.txt)
  • database presence/readability/table structure
  • HTTP endpoints and static files
  • systemd service activity
  • available disk space

safecall system doctor

Interactive diagnosis and guided remediation command.

Usage

bash
sudo ./util.sh system doctor
sudo ./util.sh system doctor --dir /opt/safecall-custom
sudo ./util.sh system doctor --offline-dir /path/to/offline-bundle

Options

OptionMeaning
--dir <directory>Diagnose specific installation directory
--offline-dir <path>Use offline bundle for version/source decisions

Behavior highlights

  • Detects missing installation and prints install instructions.
  • Detects pre-5.x layouts and offers migration via repair --migrate.
  • Detects update availability and offers in-place update.
  • Checks integrity mismatches and offers repair.

safecall system update

Performs in-place upgrade to latest version.

Usage

bash
sudo ./util.sh system update
sudo ./util.sh system update --offline-dir /path/to/offline-bundle

Behavior highlights

  • Runs pre-update selftest.
  • Stops service, updates binary and CLI bundle, regenerates wrapper, refreshes checksums/version.
  • Restarts service and runs post-update selftest.

safecall system repair

Rebuilds broken installation while preserving data/config where possible.

Usage

bash
sudo ./util.sh system repair
sudo ./util.sh system repair --migrate
sudo ./util.sh system repair --dir /opt/safecall-custom --offline-dir /path/to/offline-bundle

Options

OptionMeaning
--dir <directory>Repair target install directory
--migrateMigrate legacy 4.x layout before repair
--offline-dir <path>Use offline bundle artifacts

Behavior highlights

  • Stops/disables old service, removes stale runtime files, reinstalls core files.
  • Recreates systemd service and symlink.
  • Runs post-repair selftest.

safecall system uninstall

Completely removes installation.

Usage

bash
sudo ./util.sh system uninstall

Behavior highlights

  • Stops/disables service, removes service unit, removes CLI symlink.
  • Removes update cron entries (including legacy pattern).
  • Deletes install directory.

safecall dev test

Wrapper command for test workflows.

Usage

bash
sudo ./util.sh dev test selftest
sudo ./util.sh dev test full
sudo ./util.sh dev test clean

Options

OptionMeaning
selftestQuick health check (same as system selftest)
fullRun VM lifecycle suite
cleanRemove test artifacts

Hidden behavior

  • full delegates to test-vm.sh --quick (quick VM suite mode).
  • If test-vm.sh is missing, it tries known locations, then downloads it.

safecall dev generate util-sh (internal/advanced)

Regenerates the util.sh wrapper script.

Usage

bash
sudo ./util.sh dev generate util-sh

Notes

  • Primarily used by install/update/repair flows automatically.
  • Useful for manual recovery if wrapper script was modified or removed.