Skip to content

Instantly share code, notes, and snippets.

@blasterpal
Created September 4, 2013 17:40
Show Gist options
  • Select an option

  • Save blasterpal/6440244 to your computer and use it in GitHub Desktop.

Select an option

Save blasterpal/6440244 to your computer and use it in GitHub Desktop.
pid watcher and then do something
#!/usr/bin/ruby
pid = ARGV[0]
puts "watching and waiting for pid #{pid} to complete"
while `ps --no-headers #{pid}`.size > 0
puts "pid lives, waiting"
sleep 10
# try again
end
# do something now, notify,etc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment