def process_is_alive(name_pattern):
 return (utils.system(("pgrep -f '^([^ /]*/)*(%s)([ ]|$)'" % name_pattern), ignore_status=True) == 0)

def process_is_alive ( name_pattern ) : return ( utils . system ( ( "pgrep -f '^([^ /]*/)*(%s)([ ]|$)'" % name_pattern ) , ignore_status = True ) == 0 )
pgrep name misses all python processes and also long process names .