X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=bin%2Fkhatus_actuate_alert_to_notify_send;fp=bin%2Fkhatus_actuate_alert_to_notify_send;h=b1c695a0dd4a39e4705b09b2b34215c26a88e570;hb=43e499034fbf9fddc79b8ee9168634cb4edc98bd;hp=0000000000000000000000000000000000000000;hpb=0684c7865d61556e13e587dd8eaae538f3e862be;p=khatus.git diff --git a/bin/khatus_actuate_alert_to_notify_send b/bin/khatus_actuate_alert_to_notify_send new file mode 100755 index 0000000..b1c695a --- /dev/null +++ b/bin/khatus_actuate_alert_to_notify_send @@ -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 +}