Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(6)  |  Call(6)  |  Derive(0)  |  Import(0)

src/p/y/pyrocore-0.4.2/src/pyrocore/util/osmagic.py   pyrocore(Download)
    """
    log = logging.getLogger(__name__)
    ppid = os.getpid()
 
    try:
            sys.exit(0)
    except OSError, e:
        log.critical("fork #1 failed (PID %d): (%d) %s\n" % (os.getpid(), e.errno, e.strerror))
        sys.exit(1)
 
        pid = os.fork()
        if pid > 0:
            log.debug("Session leader exiting (PID %d, PPID %d, DEMON %d)" % (os.getpid(), ppid, pid))
            sys.exit(0)
    except OSError, e:
        log.critical("fork #2 failed (PID %d): (%d) %s\n" % (os.getpid(), e.errno, e.strerror))
        sys.exit(1)
 
    if pidfile:
        pid = str(os.getpid())