]> git.proxmox.com Git - mirror_zfs-debian.git/blob - cmd/zed/zed.d/resilver_finish-start-scrub.sh
New upstream version 0.7.9
[mirror_zfs-debian.git] / cmd / zed / zed.d / resilver_finish-start-scrub.sh
1 #!/bin/sh
2 # resilver_finish-start-scrub.sh
3 # Run a scrub after a resilver
4 #
5 # Exit codes:
6 # 1: Internal error
7 # 2: Script wasn't enabled in zed.rc
8 [ -f "${ZED_ZEDLET_DIR}/zed.rc" ] && . "${ZED_ZEDLET_DIR}/zed.rc"
9 . "${ZED_ZEDLET_DIR}/zed-functions.sh"
10
11 [ "${ZED_SCRUB_AFTER_RESILVER}" = "1" ] || exit 2
12 [ -n "${ZEVENT_POOL}" ] || exit 1
13 [ -n "${ZEVENT_SUBCLASS}" ] || exit 1
14 zed_check_cmd "${ZPOOL}" || exit 1
15
16 zed_log_msg "Starting scrub after resilver on ${ZEVENT_POOL}"
17 "${ZPOOL}" scrub "${ZEVENT_POOL}"