def process_alive?( process_name, options = {})
      return if process_name == ''

      cmd = []
      cmd << 'sudo' if options[:sudo]
      cmd << 'pgrep'
      cmd << options[:arguments].to_s if options[:arguments]
      cmd << "-f" if options[:pattern]
      cmd << (options[:pattern].is_a?( String ) ? options[:pattern] : process_name)

      pids = `#{cmd.join(' ')}`.split("\n")
      !pids.empty? && pids.all? {|p| pid_alive?( p )}
    end
def process_alive?( process_name, options = {})
      return if process_name == ''

      cmd = []
      cmd << 'sudo' if options[:sudo]
      cmd << 'pgrep'
      cmd << options[:arguments].to_s if options[:arguments]
      cmd << "-f" if options[:pattern]
      cmd << (options[:pattern].is_a?( String ) ? options[:pattern] : process_name)

      pids = `#{cmd.join(' ')}`.split("\n")
      !pids.empty? && pids.all? {|p| pid_alive?( p )}
    end
ideas for this came from the ey-flex gem
 +process_name+ - name of the process to monitor
 === Options
 +sudo+ - (default false) set to true to run pgrep as sudo
 +pattern+ - specify a pattern to match (pgrep -f) instead of the process_name
 +arguments+ - additional arguments to pgrep "-o root,blah -a"