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