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
评论列表
文章目录