Improve overview and experiment naming
[khatus.git] / x2 / src / awk / exe / actuate_alert_to_notify_send.awk
diff --git a/x2/src/awk/exe/actuate_alert_to_notify_send.awk b/x2/src/awk/exe/actuate_alert_to_notify_send.awk
new file mode 100644 (file)
index 0000000..3cfbca0
--- /dev/null
@@ -0,0 +1,29 @@
+BEGIN {
+    # Set the correct value as any other AWK variable:
+    #
+    #   khatus_actuate_alert_to_notify_send -v Display="$CORRECT_DISPLAY"
+    #
+    Display = Display ? Display : ":0"
+}
+
+{
+  delete msg
+  msg_parse(msg, $0)
+}
+
+msg["type"] == "alert" {
+    body = msg["body"]
+    sep = body ? "\n" : ""
+    body = body sep "--" msg["node"] ":" msg["module"]
+    urgency = msg["priority"]
+    sub("hi" , "critical", urgency)
+    sub("med", "normal"  , urgency)
+
+    cmd = \
+        sprintf(\
+            "DISPLAY=%s notify-send -u %s %s \" %s\"",
+            Display, urgency, msg["subject"], body \
+        )
+    system(cmd)
+    next
+}
This page took 0.031282 seconds and 4 git commands to generate.