summaryrefslogtreecommitdiffstats
path: root/samples/dbus_client.sh
diff options
context:
space:
mode:
Diffstat (limited to 'samples/dbus_client.sh')
-rwxr-xr-xsamples/dbus_client.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/samples/dbus_client.sh b/samples/dbus_client.sh
new file mode 100755
index 000000000..be23a97b2
--- /dev/null
+++ b/samples/dbus_client.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+cb() {
+ echo "$1 [${@:2}]"
+}
+
+gdbus monitor --system --dest cz.nic.knotd --object-path /cz/nic/knotd \
+ | awk '/^\/cz\/nic\/knotd/ {
+ gsub("cz.nic.knotd.events.", "", $2);
+ tmp="";
+ for(i=3;i<=NF;++i) {
+ if( $i ~ /[\),]$/ ) tmp=tmp$i;
+ }
+ gsub(/(^\()|(\)$)/, "", tmp);
+ split(tmp, args, ",");
+ printf "%s ", $2;
+ for (i in args) printf "%s ", args[i];
+ print "";
+ fflush(stdout); }' \
+ | while read line; do \
+ cb ${line[@]}; \
+ done