diff options
author | Rob Austein <sra@hactrn.net> | 2010-09-16 21:30:30 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2010-09-16 21:30:30 +0000 |
commit | be7b735fa44c0158d8ab0bc65157df45a7b45783 (patch) | |
tree | 87cfad3c536758d9eeaf96a3d16d2ad57ba5e7a5 /rpkid.without_tls/start-servers.py | |
parent | 46f13adda8ac616fa45410dc2e28a2dcc006e973 (diff) |
Preliminary version of rpkid et al with all the TLS code ripped out.
Not quite ready for cutover yet, may need some conversion tools and
instructions, but checking this into a branch (well, sort of) so that
others can look at the code changes involved, try it out themselves,
etc. At some point this will merge back into rpkid/ directory and
there will be only one, without TLS, but converting the testbed is
going to require a flag day, so need to keep the TLS version around
until then.
svn path=/rpkid.without_tls; revision=3449
Diffstat (limited to 'rpkid.without_tls/start-servers.py')
-rw-r--r-- | rpkid.without_tls/start-servers.py | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/rpkid.without_tls/start-servers.py b/rpkid.without_tls/start-servers.py new file mode 100644 index 00000000..168ca33a --- /dev/null +++ b/rpkid.without_tls/start-servers.py @@ -0,0 +1,83 @@ +""" +Start servers, logging to files, looking at config file to figure out +which servers the user wants started. + +$Id$ + +Copyright (C) 2009--2010 Internet Systems Consortium ("ISC") + +Permission to use, copy, modify, and distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + +Portions copyright (C) 2007--2008 American Registry for Internet Numbers ("ARIN") + +Permission to use, copy, modify, and distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND ARIN DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL ARIN BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + +""" + +import subprocess, os, getopt, sys, time, rpki.config + +rpkid_dir = os.path.normpath(sys.path[0]) + +os.environ["TZ"] = "UTC" +time.tzset() + +cfg_file = "myrpki.conf" +debug = False +piddir = None + +opts, argv = getopt.getopt(sys.argv[1:], "c:dhp:?", ["config=", "debug" "help", "piddir="]) +for o, a in opts: + if o in ("-h", "--help", "-?"): + print __doc__ + sys.exit(0) + elif o in ("-c", "--config"): + cfg_file = a + elif o in ("-d", "--debug"): + debug = True + elif o in ("-p", "--piddir"): + piddir = a + +cfg = rpki.config.parser(cfg_file, "myrpki") + +def run(name): + cmd = (sys.executable, os.path.join(rpkid_dir, name + ".py"), "-c", cfg_file) + if debug: + proc = subprocess.Popen(cmd + ("-d",), stdout = open(name + ".log", "a"), stderr = subprocess.STDOUT) + else: + proc = subprocess.Popen(cmd) + if proc.poll() is None: + print "Started %r, pid %s" % (name, proc.pid) + if piddir is not None: + open(os.path.join(piddir, "%s.pid" % name), "w").write("%d\n" % proc.pid) + else: + print "Problem starting %r, pid %s" % (name, proc.pid) + +if cfg.getboolean("run_rpkid", False): + run("irdbd") + run("rpkid") + +if cfg.getboolean("run_pubd", False): + run("pubd") + +if cfg.getboolean("run_rootd", False): + run("rootd") |