xref: /freebsd/sys/contrib/openzfs/cmd/zed/zed.d/all-debug.sh (revision 77013d11e6483b970af25e13c9b892075742f7e5)
1#!/bin/sh
2#
3# Log all environment variables to ZED_DEBUG_LOG.
4#
5# This can be a useful aid when developing/debugging ZEDLETs since it shows the
6# environment variables defined for each zevent.
7
8[ -f "${ZED_ZEDLET_DIR}/zed.rc" ] && . "${ZED_ZEDLET_DIR}/zed.rc"
9. "${ZED_ZEDLET_DIR}/zed-functions.sh"
10
11: "${ZED_DEBUG_LOG:="${TMPDIR:="/tmp"}/zed.debug.log"}"
12
13zed_exit_if_ignoring_this_event
14
15zed_lock "${ZED_DEBUG_LOG}"
16{
17	printenv | sort
18	echo
19} 1>&"${ZED_FLOCK_FD}"
20zed_unlock "${ZED_DEBUG_LOG}"
21
22exit 0
23