X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=x2%2Fsrc%2Fawk%2Fexe%2Factuate_alert_to_notify_send.awk;fp=x2%2Fsrc%2Fawk%2Fexe%2Factuate_alert_to_notify_send.awk;h=3cfbca0fb8dd269d4285f96d34be176754ea8fa7;hb=499c58a269a00e031302938b5a8f006f23aae451;hp=0000000000000000000000000000000000000000;hpb=4c703fadbdc17d1753d16841582636598f862416;p=khatus.git 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 index 0000000..3cfbca0 --- /dev/null +++ b/x2/src/awk/exe/actuate_alert_to_notify_send.awk @@ -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 +}