summaryrefslogtreecommitdiff
path: root/nopsyncd
diff options
context:
space:
mode:
Diffstat (limited to 'nopsyncd')
-rwxr-xr-xnopsyncd/nopsyncd.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/nopsyncd/nopsyncd.lua b/nopsyncd/nopsyncd.lua
new file mode 100755
index 0000000..5ac1acb
--- /dev/null
+++ b/nopsyncd/nopsyncd.lua
@@ -0,0 +1,21 @@
+#!/usr/bin/lua
+
+local queue_name = "/rhnop"
+
+mq = require "luamq"
+
+local q, err = mq.create(queue_name, "ro")
+if q == nil then
+ io.stderr:write("creation of message queue failed: " .. err .. "\n")
+ os.exit(1)
+end
+
+while true do
+ local msg, prio = mq.receive(q)
+ if msg == nil then
+ io.stderr:write("recv error: " .. prio .. "\n")
+ os.exit(2)
+ end
+
+ print("received message '" .. msg .. "' with prio: " .. prio)
+end