xref: /freebsd/sys/contrib/openzfs/cmd/zed/zed.d/all-debug.sh (revision e92ffd9b626833ebdbf2742c8ffddc6cd94b963e)
1eda14cbcSMatt Macy#!/bin/sh
2*e92ffd9bSMartin Matuska# shellcheck disable=SC2154
3eda14cbcSMatt Macy#
4eda14cbcSMatt Macy# Log all environment variables to ZED_DEBUG_LOG.
5eda14cbcSMatt Macy#
6eda14cbcSMatt Macy# This can be a useful aid when developing/debugging ZEDLETs since it shows the
7eda14cbcSMatt Macy# environment variables defined for each zevent.
8eda14cbcSMatt Macy
9eda14cbcSMatt Macy[ -f "${ZED_ZEDLET_DIR}/zed.rc" ] && . "${ZED_ZEDLET_DIR}/zed.rc"
10eda14cbcSMatt Macy. "${ZED_ZEDLET_DIR}/zed-functions.sh"
11eda14cbcSMatt Macy
12eda14cbcSMatt Macy: "${ZED_DEBUG_LOG:="${TMPDIR:="/tmp"}/zed.debug.log"}"
13eda14cbcSMatt Macy
14eda14cbcSMatt Macyzed_exit_if_ignoring_this_event
15eda14cbcSMatt Macy
163ff01b23SMartin Matuskazed_lock "${ZED_DEBUG_LOG}"
173ff01b23SMartin Matuska{
18eda14cbcSMatt Macy	printenv | sort
19eda14cbcSMatt Macy	echo
203ff01b23SMartin Matuska} 1>&"${ZED_FLOCK_FD}"
213ff01b23SMartin Matuskazed_unlock "${ZED_DEBUG_LOG}"
22eda14cbcSMatt Macy
23eda14cbcSMatt Macyexit 0
24