X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=src%2Fawk%2Fexe%2Factuate_alert_to_notify_send.awk;fp=bin%2Fkhatus_actuate_alert_to_notify_send;h=eae5cb5f3e3776081877bcc213e54246db40c399;hb=03c229bffd594c1facb72e0d042a88c0505c8dbc;hp=e3839172fbb072aa7eeab32c417834d84a03d944;hpb=2e820ad561199f2ccc1ee3fa7e7e708e5dc8bc39;p=khatus.git diff --git a/bin/khatus_actuate_alert_to_notify_send b/src/awk/exe/actuate_alert_to_notify_send.awk similarity index 54% rename from bin/khatus_actuate_alert_to_notify_send rename to src/awk/exe/actuate_alert_to_notify_send.awk index e383917..eae5cb5 100755 --- a/bin/khatus_actuate_alert_to_notify_send +++ b/src/awk/exe/actuate_alert_to_notify_send.awk @@ -1,31 +1,23 @@ -#! /usr/bin/awk -f - BEGIN { # Set the correct value as any other AWK variable: # - # khatus_actuate_alert_to_notify_send -v display="$CORRECT_DISPLAY" + # khatus_actuate_alert_to_notify_send -v Display="$CORRECT_DISPLAY" # - display = ":0" - FS = msg_fs ? msg_fs : "|" - OFS = msg_fs ? msg_fs : "|" - Kfs = key_fs ? key_fs : ":" + Display = Display ? Display : ":0" } $1 == "OK" && \ -$3 == "alert" { - src = $2 - priority = $4 - subject = $5 +$2 == "alert" { + priority = $3 + subject = $4 - # Not just using $6 for body - because body might contain a character + # Not just using $5 for body - because body might contain a character # identical to FS len_line = length($0) len_head = length($1 FS $2 FS $3 FS $4 FS $5 FS) len_body = len_line - len_head body = substr($0, len_head + 1, len_body) - sep = body ? "\n" : "" - body = body sep "--" src urgency = priority sub("hi" , "critical", urgency) sub("med", "normal" , urgency) @@ -33,7 +25,7 @@ $3 == "alert" { cmd = \ sprintf(\ "DISPLAY=%s notify-send -u %s %s \" %s\"", - display, urgency, subject, body \ + Display, urgency, subject, body \ ) system(cmd) next