summaryrefslogtreecommitdiffstats
path: root/cmd/zed/zed.d/all-debug.sh
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/zed/zed.d/all-debug.sh')
-rwxr-xr-xcmd/zed/zed.d/all-debug.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/cmd/zed/zed.d/all-debug.sh b/cmd/zed/zed.d/all-debug.sh
new file mode 100755
index 000000000..ae64e0a79
--- /dev/null
+++ b/cmd/zed/zed.d/all-debug.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# Log all environment variables to ZED_DEBUG_LOG.
+#
+test -f "${ZED_SCRIPT_DIR}/zed.rc" && . "${ZED_SCRIPT_DIR}/zed.rc"
+
+# Override the default umask to restrict access to a newly-created logfile.
+umask 077
+
+# Append stdout to the logfile after obtaining an advisory lock.
+exec >> "${ZED_DEBUG_LOG:=/tmp/zed.debug.log}"
+flock -x 1
+
+printenv | sort
+echo
+
+exit 0