#!/bin/bash
# =============================================================================
# plugin/event/stopping
#
# Official Unraid plugin event hook (see plugin/event/disks_mounted for the
# full explanation of this mechanism). "stopping" is the FIRST event fired
# in Unraid's shutdown sequence — before stopping_docker, stopping_svcs,
# unmounting_disks, stopping_array — which gives unraid-podman the largest
# possible window to stop containers and unmount podman.img BEFORE Unraid
# unmounts the underlying cache pool/disk out from under it.
#
# Run synchronously (no backgrounding, unlike disks_mounted) — shutdown
# must actually wait for containers to stop and storage to unmount
# cleanly; racing the array-stop sequence here risks filesystem corruption
# on podman.img (see docs/ARCHITECTURE.md section 16.1 on why this project
# treats storage integrity conservatively).
# =============================================================================

/etc/rc.d/rc.podman stop
