Files
mirror_zfs/cmd/zed/zed.d/resilver_finish-start-scrub.sh
T

21 lines
654 B
Bash
Raw Normal View History

2018-02-23 11:38:05 -08:00
#!/bin/sh
2022-01-07 01:07:54 +01:00
# shellcheck disable=SC2154
2018-02-23 11:38:05 -08:00
# resilver_finish-start-scrub.sh
# Run a scrub after a resilver
#
# Exit codes:
# 1: Internal error
# 2: Script wasn't enabled in zed.rc
2020-07-03 11:05:50 -07:00
# 3: Scrubs are automatically started for sequential resilvers
2018-02-23 11:38:05 -08:00
[ -f "${ZED_ZEDLET_DIR}/zed.rc" ] && . "${ZED_ZEDLET_DIR}/zed.rc"
. "${ZED_ZEDLET_DIR}/zed-functions.sh"
[ "${ZED_SCRUB_AFTER_RESILVER}" = "1" ] || exit 2
2020-07-03 11:05:50 -07:00
[ "${ZEVENT_RESILVER_TYPE}" != "sequential" ] || exit 3
2018-02-23 11:38:05 -08:00
[ -n "${ZEVENT_POOL}" ] || exit 1
[ -n "${ZEVENT_SUBCLASS}" ] || exit 1
zed_check_cmd "${ZPOOL}" || exit 1
zed_log_msg "Starting scrub after resilver on ${ZEVENT_POOL}"
"${ZPOOL}" scrub "${ZEVENT_POOL}"