From 5524ae404ffb897ca60162819502e4a9bd7d9599 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 31 Mar 2011 19:29:00 +0000 Subject: fixed conf file management diff --git a/rhnop-client/conf.lua b/rhnop-client/conf.lua index eb1cd29..9cc21d3 100644 --- a/rhnop-client/conf.lua +++ b/rhnop-client/conf.lua @@ -21,7 +21,7 @@ local conf = {} -local file = assert(io.open("nopcollect.conf", "r")) +local file = assert(io.open(conffile, "r")) for line in file:lines() do local k,v = string.match(line, "^([^=#]+)=(.*)$") if k and v and v ~= "" then diff --git a/rhnop-client/nopcollect b/rhnop-client/nopcollect deleted file mode 100755 index 04560e2..0000000 --- a/rhnop-client/nopcollect +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/lua --- --- rhnop --- --- Copyright (C) 2011 Christian Pointner --- --- 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 . --- --- --- 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 --- - -require "socket" - -conf = require "conf" - --- connect to server (reconnect after error) -local sock = assert(socket.tcp()) - -local ret, err = sock:connect(conf.host, conf.port) -if ret == nil then - print(err) - return 1 -end - -print "connection established" - --- TODO: load all info we don't have yet - -while true do - local timestamp = sock:receive('*l') - -- TODO: check if connection is closed - print("received: '" .. timestamp .. "'") - - -- TODO: check if we already fetched that timestamp - -- TODO: fetch info for the timestamp and insert it into local db -end -sock:close() -return 0 diff --git a/rhnop-client/nopcollect.conf b/rhnop-client/nopcollect.conf deleted file mode 100644 index 18316fb..0000000 --- a/rhnop-client/nopcollect.conf +++ /dev/null @@ -1,8 +0,0 @@ -host=127.0.0.1 -port=2345 - -db=nop -#db_host=127.0.0.1 -#db_port=3306 -db_user= -db_pwd= diff --git a/rhnop-client/nopcollectd b/rhnop-client/nopcollectd new file mode 100755 index 0000000..239011e --- /dev/null +++ b/rhnop-client/nopcollectd @@ -0,0 +1,60 @@ +#!/usr/bin/lua +-- +-- rhnop +-- +-- Copyright (C) 2011 Christian Pointner +-- +-- 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 . +-- +-- +-- 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 +-- + +require "socket" + +if #arg < 1 then + io.stderr:write("too few parameters\n") + os.exit(1) +end + +conffile = "nopcollectd." .. arg[1] .. ".conf" +conf = require "conf" + +-- connect to server (reconnect after error) +local sock = assert(socket.tcp()) + +local ret, err = sock:connect(conf.host, conf.port) +if ret == nil then + print(err) + return 1 +end + +print "connection established" + +-- TODO: load all info we don't have yet + +while true do + local timestamp = sock:receive('*l') + -- TODO: check if connection is closed + print("received: '" .. timestamp .. "'") + + -- TODO: check if we already fetched that timestamp + -- TODO: fetch info for the timestamp and insert it into local db +end +sock:close() +return 0 diff --git a/rhnop-client/nopcollectd.master.conf b/rhnop-client/nopcollectd.master.conf new file mode 100644 index 0000000..22113e6 --- /dev/null +++ b/rhnop-client/nopcollectd.master.conf @@ -0,0 +1,15 @@ +sync_host=airplay.helsinki.at +sync_port=2345 + +src_db=nop +src_host=airplay.helsinki.at +#src_port=3306 +src_user=nopcollectd +src_pwd= + +dst_db=nop +dst_table=master +dst_host=127.0.0.1 +#dst_port=3306 +dst_user=nopcollectd +dst_pwd= diff --git a/rhnop-client/nopcollectd.standby.conf b/rhnop-client/nopcollectd.standby.conf new file mode 100644 index 0000000..2597ab0 --- /dev/null +++ b/rhnop-client/nopcollectd.standby.conf @@ -0,0 +1,15 @@ +sync_host=airplay2.helsinki.at +sync_port=2345 + +src_db=nop +src_host=airplay2.helsinki.at +#src_port=3306 +src_user=nopcollectd +src_pwd= + +dst_db=nop +dst_table=standby +dst_host=127.0.0.1 +#dst_port=3306 +dst_user=nopcollectd +dst_pwd= -- cgit v0.10.2