summaryrefslogtreecommitdiff
path: root/noprml
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2011-03-30 01:13:17 (GMT)
committerChristian Pointner <equinox@helsinki.at>2011-03-30 01:13:17 (GMT)
commita4f9323b1550715446453c6015a4e2df48f98855 (patch)
tree21c4e2e21dfc5c7fee3a68c4db2a833d777961ea /noprml
parent3af25a5734457ff5aca954b2452cd32d274dbd26 (diff)
moved to new names (rhnop-client and server)
Diffstat (limited to 'noprml')
-rwxr-xr-xnoprml/noprml59
1 files changed, 0 insertions, 59 deletions
diff --git a/noprml/noprml b/noprml/noprml
deleted file mode 100755
index 31e8ab7..0000000
--- a/noprml/noprml
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/lua
---
--- rhnop
---
--- Copyright (C) 2011 Christian Pointner <equinox@helsinki.at>
---
--- This file is part of rhnop.
---
--- rhnop is free software: you can redistribute it and/or modify
--- it under the terms of the GNU General Public License as published by
--- the Free Software Foundation, either version 3 of the License, or
--- any later version.
---
--- rhnop is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--- GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License
--- along with rhnop. If not, see <http://www.gnu.org/licenses/>.
---
---
--- send now and next cart# and length to nopsyncd
--- this script should be called by the now/next macro cart
--- the arguments should be: now# nowlen next# nextlen
---
-
-local queue_name = "/rhnop"
-
-mq = require "mq"
-
--- reading timestamp (milliseconds since epoch)
-local p = assert(io.popen("/bin/date --utc '+%s %N'" , 'r'))
-local time = assert(p:read('*l'))
-p:close()
-local s, ns = assert(string.match(time, "([0-9]+) ([0-9]+)"))
-local timestamp = s*1000 + math.floor(ns/1000000)
-
--- check arguments
-if #arg < 4 then
- io.stderr:write("too few parameters\n")
- os.exit(1)
-end
-
--- open message queue
-local q, err = mq.create(queue_name, "wo")
-if q == nil then
- io.stderr:write("creation of message queue failed: " .. err .. "\n")
- os.exit(1)
-end
-
--- send out message to nopsyncd
-local result, err = mq.send(q, timestamp .. " " .. arg[1] .. " " .. arg[2] .. " " .. arg[3] .. " " .. arg[4], 0)
-if result == nil then
- io.stderr:write("sending message failed: " .. err .. "\n")
- os.exit(2)
-end
-
-mq.close(q)