| | 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 | { |
| | 10 | delete msg |
| | 11 | msg_parse(msg, $0) |
| | 12 | } |
| | 13 | |
| | 14 | msg["type"] == "alert" { |
| | 15 | body = msg["body"] |
| | 16 | sep = body ? "\n" : "" |
| | 17 | body = body sep "--" msg["node"] ":" msg["module"] |
| | 18 | urgency = msg["priority"] |
| | 19 | sub("hi" , "critical", urgency) |
| | 20 | sub("med", "normal" , urgency) |
| | 21 | |
| | 22 | cmd = \ |
| | 23 | sprintf(\ |
| | 24 | "DISPLAY=%s notify-send -u %s %s \" %s\"", |
| | 25 | Display, urgency, msg["subject"], body \ |
| | 26 | ) |
| | 27 | system(cmd) |
| | 28 | next |
| | 29 | } |