def _iter_service_names():
 found = set()
 for line in glob.glob('/etc/init.d/*'):
  name = os.path.basename(line)
  found.add(name)
  (yield name)
 init_root = '/etc/init/'
 for (root, dirnames, filenames) in os.walk(init_root):
  relpath = os.path.relpath(root, init_root)
  for filename in fnmatch.filter(filenames, '*.conf'):
   if (relpath == '.'):
    name = filename[:(-5)]
   else:
    name = os.path.join(relpath, filename[:(-5)])
   if (name in found):
    continue
   (yield name)

def _iter_service_names ( ) : found = set ( ) for line in glob . glob ( '/etc/init.d/*' ) : name = os . path . basename ( line ) found . add ( name ) ( yield name ) init_root = '/etc/init/' for ( root , dirnames , filenames ) in os . walk ( init_root ) : relpath = os . path . relpath ( root , init_root ) for filename in fnmatch . filter ( filenames , '*.conf' ) : if ( relpath == '.' ) : name = filename [ : ( - 5 ) ] else : name = os . path . join ( relpath , filename [ : ( - 5 ) ] ) if ( name in found ) : continue ( yield name )
detect all of the service names available to upstart via init configuration files and via classic sysv init scripts .