X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=doc%2Fexamples%2Ftrigger-on-event%2Fdemo.sh;fp=doc%2Fexamples%2Ftrigger-on-event%2Fdemo.sh;h=9bf8a00830f757563e134616280b1229c0d82d24;hp=0000000000000000000000000000000000000000;hb=2463b7879c00298daa79744cdaae82ac061a4ed8;hpb=3a4595c2469472dee1656cde5f8882c2123efd3c diff --git a/doc/examples/trigger-on-event/demo.sh b/doc/examples/trigger-on-event/demo.sh new file mode 100755 index 000000000..9bf8a0083 --- /dev/null +++ b/doc/examples/trigger-on-event/demo.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# +# Copyright (C) 2020 Jérémie Galarneau +# +# SPDX-License-Identifier: MIT + +EVENT_NAME=trigger_example:my_event +TRIGGER_NAME=demo_trigger +TRIGGER_NAME_CAPTURE=demo_trigger_capture + +lttng list > /dev/null 2>&1 +if [ $? -ne 0 ]; then + echo "Could not connect to session daemon, are you sure it is running?" + exit 1 +fi + +echo "Registering a notification trigger named \"$TRIGGER_NAME\" for the $EVENT_NAME user-space event" +lttng add-trigger --id $TRIGGER_NAME --condition on-event --userspace $EVENT_NAME --action notify +lttng add-trigger --id $TRIGGER_NAME_CAPTURE --condition on-event --userspace $EVENT_NAME --capture 'iteration' --capture 'does_not_exist' --capture '$ctx.vtid' --capture '$ctx.procname' --action notify + +./notification-client $TRIGGER_NAME $TRIGGER_NAME_CAPTURE +