eae5cb5f3e3776081877bcc213e54246db40c399
[khatus.git] / src / awk / exe / actuate_alert_to_notify_send.awk
1 BEGIN {
2 # Set the correct value as any other AWK variable:
3 #
4 # khatus_actuate_alert_to_notify_send -v Display="$CORRECT_DISPLAY"
5 #
6 Display = Display ? Display : ":0"
7 }
8
9 $1 == "OK" && \
10 $2 == "alert" {
11 priority = $3
12 subject = $4
13
14 # Not just using $5 for body - because body might contain a character
15 # identical to FS
16 len_line = length($0)
17 len_head = length($1 FS $2 FS $3 FS $4 FS $5 FS)
18 len_body = len_line - len_head
19 body = substr($0, len_head + 1, len_body)
20
21 urgency = priority
22 sub("hi" , "critical", urgency)
23 sub("med", "normal" , urgency)
24
25 cmd = \
26 sprintf(\
27 "DISPLAY=%s notify-send -u %s %s \" %s\"",
28 Display, urgency, subject, body \
29 )
30 system(cmd)
31 next
32 }
This page took 0.051035 seconds and 3 git commands to generate.