diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml
index cd21d5b28d..3378689b75 100644
--- a/man/systemd.exec.xml
+++ b/man/systemd.exec.xml
@@ -3546,6 +3546,41 @@ StandardInputData=SWNrIHNpdHplIGRhIHVuJyBlc3NlIEtsb3BzLAp1ZmYgZWVtYWwga2xvcHAncy
+
+ $MONITOR_METADATA
+
+ Only defined for the service unit type, this environment variable is passed to all
+ ExecStart= and ExecStartPre= processes which run in services
+ triggered by OnFailure= or OnSuccess= dependencies.
+
+
+ The contents of this variable consists of a semi-colon separated list of metadata fields associated with the triggering
+ service. For each service which triggered the OnFailure= or OnSuccess=
+ dependency the following fields will be set:
+
+
+
+ SERVICE_RESULT
+ EXIT_CODE
+ EXIT_STATUS
+ INVOCATION_ID
+ UNIT
+
+
+ The fields SERVICE_RESULT, EXIT_CODE and
+ EXIT_STATUS may take the same values that are allowed when set for
+ ExecStop= and ExecStopPost= processes. The fields
+ INVOCATION_ID and UNIT are the invocaton id and unit
+ name of the service which triggered the dependency. Each field is comma separated, i.e.
+
+
+SERVICE_RESULT=result-string,EXIT_CODE=exit-code,EXIT_STATUS=exit-status,INVOCATION_ID=invocation-id,UNIT=triggering.service
+
+
+
+
+
+
$PIDFILE
@@ -3983,6 +4018,77 @@ StandardInputData=SWNrIHNpdHplIGRhIHVuJyBlc3NlIEtsb3BzLAp1ZmYgZWVtYWwga2xvcHAncy
+
+ Examples
+
+
+ $MONITOR_METADATA usage
+
+ A service myfailer.service which can trigger an
+ OnFailure= dependency.
+
+
+[Unit]
+Description=Service which can trigger an OnFailure= dependency
+OnFailure=myhandler.service
+
+[Service]
+ExecStart=/bin/myprogram
+
+
+ A service mysuccess.service which can trigger an
+ OnSuccess= dependency.
+
+
+[Unit]
+Description=Service which can trigger an OnSuccess= dependency
+OnSuccess=myhandler.service
+
+[Service]
+ExecStart=/bin/mysecondprogram
+
+
+ A service myhandler.service which can be triggered
+ by any of the above services.
+
+
+[Unit]
+Description=Acts on service failing or succeeding
+
+[Service]
+ExecStart=/bin/bash -c "echo $MONITOR_METADATA"
+
+
+ If myfailer.service were to run and exit in failure,
+ then myhandler.service would be triggered and the
+ $MONITOR_METADATA variable would be set as follows:
+
+
+MONITOR_METADATA=SERVICE_RESULT=result-string,EXIT_CODE=exit-code,EXIT_STATUS=exit-status,INVOCATION_ID=invocation-id,UNIT=myfailer.service
+
+
+ If mysuccess.service were to run and exit in success,
+ then myhandler.service would be triggered and the
+ $MONITOR_METADATA variable would be set as follows:
+
+
+MONITOR_METADATA=SERVICE_RESULT=result-string,EXIT_CODE=exit-code,EXIT_STATUS=exit-status,INVOCATION_ID=invocation-id,UNIT=mysuccess.service
+
+
+ If myfailer.service and mysuccess.service were to run and exit,
+ there is a chance that the triggered dependency start job might be merged. Thus only a single invocation of
+ myhandler.service would be triggered. In this case the $MONITOR_METADATA variable
+ would be a list containing exit metadata for both of myfailer.service
+ and mysuccess.service.
+
+
+MONITOR_METADATA=SERVICE_RESULT=result-string,EXIT_CODE=exit-code,EXIT_STATUS=exit-status,INVOCATION_ID=invocation-id,UNIT=myfailer.service;SERVICE_RESULT=result-string,EXIT_CODE=exit-code,EXIT_STATUS=exit-status,INVOCATION_ID=invocation-id,UNIT=mysuccess.service
+
+
+
+
+
+
See Also