#NEWLINE# def start( watch , is_group = True ) : #NEWLINE# #INDENT# ' Instructs monit to start the given program, assuming that a configuration\n  file has already been written for it.\n\n  Args:\n    watch: A str representing the name of the program to start up and monitor.\n    is_group: A bool that indicates if we want to stop a group of programs, or\n      only a single program.\n  Returns:\n    True if the program was started, or False if (1) the named program is not a\n    valid program name, (2) if monit could not be reloaded to read the new\n    configuration file, or (3) monit could not start the new program.\n  ' #NEWLINE# if ( not misc . is_string_secure ( watch ) ) : #NEWLINE# #INDENT# logging . error ( 'Watch string [{0}] is a possible security violation' . format ( watch ) ) #NEWLINE# return False #NEWLINE# #UNINDENT# logging . info ( 'Reloading monit.' ) #NEWLINE# if ( not run_with_retry ( [ MONIT , 'reload' ] ) ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# logging . info ( 'Starting watch {0}' . format ( watch ) ) #NEWLINE# if is_group : #NEWLINE# #INDENT# run_with_retry ( [ MONIT , 'monitor' , '-g' , watch ] ) #NEWLINE# return run_with_retry ( [ MONIT , 'start' , '-g' , is_group ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# run_with_retry ( [ MONIT , 'monitor' , watch ] ) #NEWLINE# return run_with_retry ( [ MONIT , 'start' , watch ] )