diff options
Diffstat (limited to 'rp/rcynic/rcynic-cron')
-rwxr-xr-x | rp/rcynic/rcynic-cron | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/rp/rcynic/rcynic-cron b/rp/rcynic/rcynic-cron index 73368e0d..dc26e9a0 100755 --- a/rp/rcynic/rcynic-cron +++ b/rp/rcynic/rcynic-cron @@ -32,6 +32,7 @@ import pwd import fcntl import errno import argparse +import rpki.autoconf def run(*cmd, **kwargs): chroot_this = kwargs.pop("chroot_this", False) @@ -39,13 +40,13 @@ def run(*cmd, **kwargs): pid = os.fork() if pid == 0: if chroot_this: - os.chdir(rpki.autoconf.rcynic_dir) + os.chdir(rpki.autoconf.RCYNIC_DIR) elif cwd is not None: os.chdir(cwd) if we_are_root: os.initgroups(pw.pw_name, pw.pw_gid) if chroot_this: - os.chroot(rpki.autoconf.rcynic_dir) + os.chroot(rpki.autoconf.RCYNIC_DIR) if we_are_root: os.setgid(pw.pw_gid) os.setuid(pw.pw_uid) @@ -73,12 +74,13 @@ if args.chroot and not we_are_root: sys.exit("Only root can --chroot") try: - pw = pwd.getpwnam(rpki.autoconf.rcynic_user) + pw = pwd.getpwnam(rpki.autoconf.RCYNIC_USER) except KeyError: - sys.exit("Could not find passwd entry for user %s" % rpki.autoconf.rcynic_user) + sys.exit("Could not find passwd entry for user %s" % rpki.autoconf.RCYNIC_USER) try: - lock = os.open(os.path.join(rpki.autoconf.rcynic_dir, "data/lock"), os.O_RDONLY | os.O_CREAT | os.O_NONBLOCK, 0666) + lock = os.open(os.path.join(rpki.autoconf.RCYNIC_DIR, "data/lock"), + os.O_RDONLY | os.O_CREAT | os.O_NONBLOCK, 0666) fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB) if we_are_root: os.fchown(lock, pw.pw_uid, pw.pw_gid) @@ -86,7 +88,7 @@ except (IOError, OSError), e: if e.errno == errno.EAGAIN: sys.exit(0) # Another instance of this script is already running, exit silently else: - sys.exit("Error %r opening lock %r" % (e.strerror, os.path.join(rpki.autoconf.rcynic_dir, "data/lock"))) + sys.exit("Error %r opening lock %r" % (e.strerror, os.path.join(rpki.autoconf.RCYNIC_DIR, "data/lock"))) if args.chroot: run("/bin/rcynic", "-c", "/etc/rcynic.conf", chroot_this = True) @@ -95,14 +97,14 @@ else: run(os.path.join(rpki.autoconf.bindir, "rtr-origin"), "--cronjob", - os.path.join(rpki.autoconf.rcynic_dir, "data/authenticated"), - cwd = os.path.join(rpki.autoconf.rcynic_dir, "rpki-rtr")) + os.path.join(rpki.autoconf.RCYNIC_DIR, "data/authenticated"), + cwd = os.path.join(rpki.autoconf.RCYNIC_DIR, "rpki-rtr")) prog = os.path.join(rpki.autoconf.libexecdir, "rpkigui-rcynic") if os.path.exists(prog): run(prog) -if rpki.autoconf.rcynic_html_dir and os.path.exists(os.path.dirname(rpki.autoconf.rcynic_html_dir)): +if rpki.autoconf.RCYNIC_HTML_DIR and os.path.exists(os.path.dirname(rpki.autoconf.RCYNIC_HTML_DIR)): run(os.path.join(rpki.autoconf.bindir, "rcynic-html"), - os.path.join(rpki.autoconf.rcynic_dir, "data/rcynic.xml"), - rpki.autoconf.rcynic_html_dir) + os.path.join(rpki.autoconf.RCYNIC_DIR, "data/rcynic.xml"), + rpki.autoconf.RCYNIC_HTML_DIR) |