The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/contrib/openzfs/cmd/zed/zed.d/trim_finish-notify.sh

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 #!/bin/sh
    2 # shellcheck disable=SC2154
    3 #
    4 # Send notification in response to a TRIM_FINISH. The event
    5 # will be received for each vdev in the pool which was trimmed.
    6 #
    7 # Exit codes:
    8 #   0: notification sent
    9 #   1: notification failed
   10 #   2: notification not configured
   11 #   9: internal error
   12 
   13 [ -f "${ZED_ZEDLET_DIR}/zed.rc" ] && . "${ZED_ZEDLET_DIR}/zed.rc"
   14 . "${ZED_ZEDLET_DIR}/zed-functions.sh"
   15 
   16 [ -n "${ZEVENT_POOL}" ] || exit 9
   17 [ -n "${ZEVENT_SUBCLASS}" ] || exit 9
   18 
   19 zed_check_cmd "${ZPOOL}" || exit 9
   20 
   21 umask 077
   22 note_subject="ZFS ${ZEVENT_SUBCLASS} event for ${ZEVENT_POOL} on $(hostname)"
   23 note_pathname="$(mktemp)"
   24 {
   25     echo "ZFS has finished a trim:"
   26     echo
   27     echo "   eid: ${ZEVENT_EID}"
   28     echo " class: ${ZEVENT_SUBCLASS}"
   29     echo "  host: $(hostname)"
   30     echo "  time: ${ZEVENT_TIME_STRING}"
   31 
   32     "${ZPOOL}" status -t "${ZEVENT_POOL}"
   33 
   34 } > "${note_pathname}"
   35 
   36 zed_notify "${note_subject}" "${note_pathname}"; rv=$?
   37 rm -f "${note_pathname}"
   38 exit "${rv}"

Cache object: 21ad1b446cc61a7cc9efdab7e1e5ab84


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.