Skip to content

Update grafana PID storage logic

Fixes #116 (closed)

Previously, the Grafana PID file ($GRAFANA_DATA_DIR/grafana.pid) could become stale or not get updated correctly when:

  • Grafana failed to start properly.
  • User forgot to run stop-all-swh-backends.sh so the PID file existed before Grafana started
  • Grafana crashed or was killed externally, leaving an outdated PID file.

This caused shutdown scripts to fail, and in some cases, Adastra admins had to manually kill orphaned processes.

Changes

  • Added a retry mechanism to validate that the Grafana process is running before writing the PID file instead of waiting for the file to exist.
  • Ensured the PID is only written after a successful process check (ps + grep grafana).
  • Improved logging so the PID lifecycle is clearer.

How to Test

  1. Run the whole pipeline on Adastra
  2. Confirm that grafana.pid is created only after Grafana is fully started.
Edited by Zhihan Zhang

Merge request reports

Loading