1#!/bin/sh 2# shellcheck disable=SC2154 3# resilver_finish-start-scrub.sh 4# Run a scrub after a resilver 5# 6# Exit codes: 7# 1: Internal error 8# 2: Script wasn't enabled in zed.rc 9# 3: Scrubs are automatically started for sequential resilvers 10[ -f "${ZED_ZEDLET_DIR}/zed.rc" ] && . "${ZED_ZEDLET_DIR}/zed.rc" 11. "${ZED_ZEDLET_DIR}/zed-functions.sh" 12 13[ "${ZED_SCRUB_AFTER_RESILVER}" = "1" ] || exit 2 14[ "${ZEVENT_RESILVER_TYPE}" != "sequential" ] || exit 3 15[ -n "${ZEVENT_POOL}" ] || exit 1 16[ -n "${ZEVENT_SUBCLASS}" ] || exit 1 17zed_check_cmd "${ZPOOL}" || exit 1 18 19zed_log_msg "Starting scrub after resilver on ${ZEVENT_POOL}" 20"${ZPOOL}" scrub "${ZEVENT_POOL}" 21