| 1 | #! /usr/bin/awk -f |
| 2 | |
| 3 | BEGIN { |
| 4 | # Set the correct value as any other AWK variable: |
| 5 | # |
| 6 | # khatus_actuate_alert_to_notify_send -v display="$CORRECT_DISPLAY" |
| 7 | # |
| 8 | display = ":0" |
| 9 | } |
| 10 | |
| 11 | /^ALERT / { |
| 12 | src = $2 |
| 13 | priority = $3 |
| 14 | subject = $4 |
| 15 | sub("^" $1 " +" $2 " +" $3 " +" $4 " +", "") |
| 16 | body = $0 |
| 17 | |
| 18 | sep = body ? "\n" : "" |
| 19 | body = body sep "--" src |
| 20 | urgency = priority |
| 21 | sub("hi" , "critical", urgency) |
| 22 | sub("med", "normal" , urgency) |
| 23 | |
| 24 | cmd = \ |
| 25 | sprintf(\ |
| 26 | "DISPLAY=%s notify-send -u %s %s \" %s\"", |
| 27 | display, urgency, subject, body \ |
| 28 | ) |
| 29 | system(cmd) |
| 30 | next |
| 31 | } |