def put_pidfile ( pidfile_path , pid ) : with open ( pidfile_path , "w" ) as f : f . write ( "%s" % pid ) os . fsync ( f . fileno ( ) ) return
python using a pidfile
Put a PID into a pidfile
def put_pidfile( pidfile_path, pid ):
    """
    Put a PID into a pidfile
    """
    with open( pidfile_path, "w" ) as f:
        f.write("%s" % pid)
        os.fsync(f.fileno())

    return