SoW-2019-0002: Dynamic Snapshot
[lttng-tools.git] / doc / examples / trigger-on-event / demo.sh
diff --git a/doc/examples/trigger-on-event/demo.sh b/doc/examples/trigger-on-event/demo.sh
new file mode 100755 (executable)
index 0000000..61623fb
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/bash
+#
+# Copyright (C) 2020 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+#
+# SPDX-License-Identifier: MIT
+
+EVENT_NAME=trigger_exemple:my_event
+TRIGGER_NAME=demo_trigger
+
+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
+
+./notification-client $TRIGGER_NAME
+
This page took 0.0248 seconds and 5 git commands to generate.