parameters: (pidfile_path)
docstring: Write the PID in the named PID file.
  
          Get the numeric process ID (“PID”) of the current process
          and write it to the named file as a line of text.
docstring_summary: Write the PID in the named PID file.
docstring_tokens: Write the PID in the named PID file .
function: def write_pid_to_pidfile(pidfile_path):
      """ Write the PID in the named PID file.
  
          Get the numeric process ID (“PID”) of the current process
          and write it to the named file as a line of text.
  
          """
      open_flags = (os.O_CREAT | os.O_EXCL | os.O_WRONLY)
      open_mode = 0o644
      pidfile_fd = os.open(pidfile_path, open_flags, open_mode)
      pidfile = os.fdopen(pidfile_fd, 'w')
  
      # According to the FHS 2.3 section on PID files in /var/run:
      #
      #   The file must consist of the process identifier in
      #   ASCII-encoded decimal, followed by a newline character. For
      #   example, if crond was process number 25, /var/run/crond.pid
      #   would contain three characters: two, five, and newline.
  
      pid = os.getpid()
      line = "%(pid)d\n" % vars()
      pidfile.write(line)
      pidfile.close()
function_tokens: def write_pid_to_pidfile ( pidfile_path ) : open_flags = ( os . O_CREAT | os . O_EXCL | os . O_WRONLY ) open_mode = 0o644 pidfile_fd = os . open ( pidfile_path , open_flags , open_mode ) pidfile = os . fdopen ( pidfile_fd , 'w' ) # According to the FHS 2.3 section on PID files in /var/run: # #   The file must consist of the process identifier in #   ASCII-encoded decimal, followed by a newline character. For #   example, if crond was process number 25, /var/run/crond.pid #   would contain three characters: two, five, and newline. pid = os . getpid ( ) line = "%(pid)d\n" % vars ( ) pidfile . write ( line ) pidfile . close ( )