def find_couchbase_pid():
 if (not os.path.isfile(COUCHBASE_INITFILE)):
  return
 try:
  fd = open(COUCHBASE_INITFILE)
  for line in fd:
   if line.startswith('exec'):
    init_script = line.split()[1]
  fd.close()
 except IOError:
  utils.err(('Check permission of file (%s)' % COUCHBASE_INITFILE))
  return
 try:
  fd = open(init_script)
  for line in fd:
   if line.startswith('PIDFILE'):
    pid_file = line.split('=')[1].rsplit()[0]
  fd.close()
 except IOError:
  utils.err(('Check permission of file (%s)' % init_script))
  return
 try:
  fd = open(pid_file)
  pid = fd.read()
  fd.close()
 except IOError:
  utils.err('Couchbase-server is not running, since no pid file exists')
  return
 return pid.split()[0]

def find_couchbase_pid ( ) : if ( not os . path . isfile ( COUCHBASE_INITFILE ) ) : return try : fd = open ( COUCHBASE_INITFILE ) for line in fd : if line . startswith ( 'exec' ) : init_script = line . split ( ) [ 1 ] fd . close ( ) except IOError : utils . err ( ( 'Check permission of file (%s)' % COUCHBASE_INITFILE ) ) return try : fd = open ( init_script ) for line in fd : if line . startswith ( 'PIDFILE' ) : pid_file = line . split ( '=' ) [ 1 ] . rsplit ( ) [ 0 ] fd . close ( ) except IOError : utils . err ( ( 'Check permission of file (%s)' % init_script ) ) return try : fd = open ( pid_file ) pid = fd . read ( ) fd . close ( ) except IOError : utils . err ( 'Couchbase-server is not running, since no pid file exists' ) return return pid . split ( ) [ 0 ]
find out the pid of couchbase .