diff options
Diffstat (limited to 'src/nopcollectd')
-rwxr-xr-x | src/nopcollectd | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/nopcollectd b/src/nopcollectd index 0f7c66e..933fb81 100755 --- a/src/nopcollectd +++ b/src/nopcollectd @@ -2,7 +2,7 @@ -- -- rhnop -- --- Copyright (C) 2011-2014 Christian Pointner <equinox@helsinki.at> +-- Copyright (C) 2011-2015 Christian Pointner <equinox@helsinki.at> -- -- This file is part of rhnop. -- @@ -25,24 +25,24 @@ -- the arguments should be: now# nowlen next# nextlen -- -require "socket" +socket = require "socket" package.path = package.path .. ";_rhnoplibdir_/?.lua" db = require "db" +conf = require "conf" if #arg < 1 then io.stderr:write("too few parameters\n") os.exit(1) end -conffile = "nopcollectd." .. arg[1] .. ".conf" -conf = require "conf" +local cnf = conf.load("nopcollectd." .. arg[1] .. ".conf") -src_db = assert(db.init(conf.src_db, conf.src_user, conf.src_pwd, conf.src_host, conf.src_port, conf.src_table)) -dst_db = assert(db.init(conf.dst_db, conf.dst_user, conf.dst_pwd, conf.dst_host, conf.dst_port, conf.dst_table)) +src_db = assert(db.init(cnf.src_db, cnf.src_user, cnf.src_pwd, cnf.src_host, cnf.src_port, cnf.src_table)) +dst_db = assert(db.init(cnf.dst_db, cnf.dst_user, cnf.dst_pwd, cnf.dst_host, cnf.dst_port, cnf.dst_table)) local sock = assert(socket.tcp()) -local ret, err = sock:connect(conf.sync_host, conf.sync_port) +local ret, err = sock:connect(cnf.sync_host, cnf.sync_port) if ret == nil then print(err) return 1 |