Skip to content

Instantly share code, notes, and snippets.

@tc
Created May 23, 2011 23:46

Revisions

  1. tc revised this gist May 23, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # helper functions for managing tasks
    # helper functions for managing processes

    def run_system_command(cmd)
    puts cmd
  2. tc created this gist May 23, 2011.
    11 changes: 11 additions & 0 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    # helper functions for managing tasks

    def run_system_command(cmd)
    puts cmd
    status = system(cmd)
    $?.exitstatus
    end

    def kill_matching_process_cmd(process_name)
    cmd = "echo `ps -ef | grep -v grep | grep \"#{process_name.gsub("-", "\\-")}\" | awk '{print $2}'` | xargs kill"
    end