def _get_rc():
 daemons_flags = {}
 try:
  with salt.utils.fopen('/etc/rc', 'r') as handle:
   lines = handle.readlines()
 except IOError:
  log.error('Unable to read /etc/rc')
 else:
  for line in lines:
   match = start_daemon_call_regex.match(line)
   if match:
    line = line[len(match.group(1)):]
    for daemon in start_daemon_parameter_regex.findall(line):
     daemons_flags[daemon] = True
 variables = __salt__['cmd.run']('(. /etc/rc.conf && set)', clean_env=True, output_loglevel='quiet', python_shell=True).split('\n')
 for var in variables:
  match = service_flags_regex.match(var)
  if match:
   if (match.group(2) == 'NO'):
    daemons_flags[match.group(1)] = False
  else:
   match = pkg_scripts_regex.match(var)
   if match:
    for daemon in match.group(1).split():
     daemons_flags[daemon] = True
 return daemons_flags

def _get_rc ( ) : daemons_flags = { } try : with salt . utils . fopen ( '/etc/rc' , 'r' ) as handle : lines = handle . readlines ( ) except IOError : log . error ( 'Unable to read /etc/rc' ) else : for line in lines : match = start_daemon_call_regex . match ( line ) if match : line = line [ len ( match . group ( 1 ) ) : ] for daemon in start_daemon_parameter_regex . findall ( line ) : daemons_flags [ daemon ] = True variables = __salt__ [ 'cmd.run' ] ( '(. /etc/rc.conf && set)' , clean_env = True , output_loglevel = 'quiet' , python_shell = True ) . split ( '\n' ) for var in variables : match = service_flags_regex . match ( var ) if match : if ( match . group ( 2 ) == 'NO' ) : daemons_flags [ match . group ( 1 ) ] = False else : match = pkg_scripts_regex . match ( var ) if match : for daemon in match . group ( 1 ) . split ( ) : daemons_flags [ daemon ] = True return daemons_flags
returns a dict where the key is the daemons name and the value a boolean indicating its status .