Split actuator into 2
[khatus.git] / bin / khatus_actuate_alert_to_notify_send
diff --git a/bin/khatus_actuate_alert_to_notify_send b/bin/khatus_actuate_alert_to_notify_send
new file mode 100755 (executable)
index 0000000..b1c695a
--- /dev/null
@@ -0,0 +1,31 @@
+#! /usr/bin/awk -f
+
+BEGIN {
+    # Set the correct value as any other AWK variable:
+    #
+    #   khatus_actuate_alert_to_notify_send -v display="$CORRECT_DISPLAY"
+    #
+    display = ":0"
+}
+
+/^ALERT / {
+    src      = $2
+    priority = $3
+    subject  = $4
+    sub("^" $1 " +" $2 " +" $3 " +" $4 " +", "")
+    body     = $0
+
+    sep = body ? "\n" : ""
+    body = body sep "--" src
+    urgency = priority
+    sub("hi" , "critical", urgency)
+    sub("med", "normal"  , urgency)
+
+    cmd = \
+        sprintf(\
+            "DISPLAY=%s notify-send -u %s %s \" %s\"",
+            display, urgency, subject, body \
+        )
+    system(cmd)
+    next
+}
This page took 0.022136 seconds and 4 git commands to generate.