18 lines
748 B
Bash
Executable File
18 lines
748 B
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
# A native shutdown is irrevocable once started. Keep this hook alive on failure
|
|
# instead of letting a nonzero script exit trigger final process killing.
|
|
if ! /usr/bin/fds-power --shutdown-hook; then
|
|
printf 'FDS shutdown helper failed; remaining powered on for recovery.\n' >&2
|
|
exec /usr/bin/fds-power --hold-shutdown
|
|
fi
|
|
failed=()
|
|
if [[ -d /run/s6-rc ]]; then
|
|
if ! s6-rc -b -l /run/s6-rc -t 15000 -d -a change; then
|
|
printf 'FDS service stop failed after verified DATA unmount; native cleanup will terminate remaining processes.\n' >&2
|
|
failed=(failed)
|
|
fi
|
|
fi
|
|
/usr/bin/fds-power --record-final "${failed[@]}"
|
|
# s6-linux-init-shutdownd handles the final process cleanup, sync and unmount.
|