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