ngamsDaemon.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:ngas 作者: ICRAR 项目源码 文件源码
def start(args, cfg, pidfile):

    # Ensure the directory is there to keep the PID file
    try:
        os.makedirs(os.path.join(cfg.getRootDirectory(), 'var', 'run'))
    except OSError:
        pass

    if os.path.isfile(pidfile):
        pid = lockfile.pidlockfile.read_pid_from_pidfile(pidfile)
        err('PID file %s already exists (pid=%d), not overwriting possibly existing instance' % (pidfile, pid,))
        return 1

    # Go, go, go!
    with daemon.DaemonContext(pidfile=lockfile.pidlockfile.PIDLockFile(pidfile, timeout=1)):
        ngamsSrv = ngamsServer.ngamsServer()
        ngamsSrv.init(args)

    return 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号