summaryrefslogtreecommitdiff
path: root/rhnop-server
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2011-04-02 16:03:14 (GMT)
committerChristian Pointner <equinox@helsinki.at>2011-04-02 16:03:14 (GMT)
commit96889f1baf748b33f65398c79c03b439eaa0f3ef (patch)
tree7a6941dc54ca23997f4b3504fcd3882ccd2a8a9e /rhnop-server
parent5524ae404ffb897ca60162819502e4a9bd7d9599 (diff)
fixed runit script
added log service to runit switched to microseconds for timestamps
Diffstat (limited to 'rhnop-server')
-rw-r--r--rhnop-server/debian/changelog8
-rw-r--r--rhnop-server/debian/rhnop-server.runit4
-rw-r--r--rhnop-server/debian/rhnop-server.runit.log9
-rwxr-xr-xrhnop-server/debian/rules5
-rwxr-xr-xrhnop-server/noprml8
5 files changed, 28 insertions, 6 deletions
diff --git a/rhnop-server/debian/changelog b/rhnop-server/debian/changelog
index a19e45b..63874b1 100644
--- a/rhnop-server/debian/changelog
+++ b/rhnop-server/debian/changelog
@@ -1,3 +1,11 @@
+rhnop-server (0.8) unstable; urgency=low
+
+ * fixed runit script.
+ * added log services to runit.
+ * switched to microsends for timestamp.
+
+ -- Christian Pointner <equinox@helsinki> Wed, 02 Apr 2011 17:53:25 +0200
+
rhnop-server (0.7) unstable; urgency=low
* fixed utf-8 handling.
diff --git a/rhnop-server/debian/rhnop-server.runit b/rhnop-server/debian/rhnop-server.runit
index b559b3e..37b0795 100644
--- a/rhnop-server/debian/rhnop-server.runit
+++ b/rhnop-server/debian/rhnop-server.runit
@@ -1,3 +1,5 @@
#!/bin/sh
+set -e
-chpst -u rhnop:rhnop /usr/bin/nopsyncd
+exec 2>&1
+exec chpst -u rhnop:rhnop /usr/bin/nopsyncd
diff --git a/rhnop-server/debian/rhnop-server.runit.log b/rhnop-server/debian/rhnop-server.runit.log
new file mode 100644
index 0000000..a8766ea
--- /dev/null
+++ b/rhnop-server/debian/rhnop-server.runit.log
@@ -0,0 +1,9 @@
+#!/bin/sh
+set -e
+
+LOG_D="/var/log/nopsyncd/"
+if [ ! -d "$LOG_D" ]; then
+ mkdir -p -m0750 "$LOG_D"
+fi
+chown root:adm "$LOG_D"
+exec chpst -u root:adm svlogd -tt "$LOG_D"
diff --git a/rhnop-server/debian/rules b/rhnop-server/debian/rules
index 29cb020..ac5d9fc 100755
--- a/rhnop-server/debian/rules
+++ b/rhnop-server/debian/rules
@@ -34,9 +34,11 @@ install: build
dh_testroot
dh_installdirs
$(MAKE) DESTDIR=$(CURDIR)/debian/rhnop-server install
- mkdir -p $(CURDIR)/debian/rhnop-server/etc/sv/rhnop-server
+ mkdir -p $(CURDIR)/debian/rhnop-server/etc/sv/rhnop-server/log
ln -s /var/run/sv.rhnop-server/ $(CURDIR)/debian/rhnop-server/etc/sv/rhnop-server/supervise
cp $(CURDIR)/debian/rhnop-server.runit $(CURDIR)/debian/rhnop-server/etc/sv/rhnop-server/run
+ ln -s /var/run/sv.rhnop-server.log/ $(CURDIR)/debian/rhnop-server/etc/sv/rhnop-server/log/supervise
+ cp $(CURDIR)/debian/rhnop-server.runit.log $(CURDIR)/debian/rhnop-server/etc/sv/rhnop-server/log/run
# Build architecture-independent files here.
binary-indep: install
@@ -55,6 +57,7 @@ binary-arch: install
dh_fixperms
chmod 640 debian/rhnop-server/etc/rhnop/nopsyncd.conf
chmod 755 debian/rhnop-server/etc/sv/rhnop-server/run
+ chmod 755 debian/rhnop-server/etc/sv/rhnop-server/log/run
dh_installdeb
dh_shlibdeps
dh_gencontrol
diff --git a/rhnop-server/noprml b/rhnop-server/noprml
index 6065948..a763de3 100755
--- a/rhnop-server/noprml
+++ b/rhnop-server/noprml
@@ -27,15 +27,12 @@
local queue_name = "/rhnop"
-require "posix"
-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)
+local timestamp = s .. string.format("%06d", math.floor(ns/1000))
-- check arguments
if #arg < 4 then
@@ -43,6 +40,9 @@ if #arg < 4 then
os.exit(1)
end
+require "posix"
+mq = require "mq"
+
-- open message queue
posix.umask("rwxrwxr-x")
local q, err = mq.create(queue_name, "wo", "rw-rw----")