Skip to content

Instantly share code, notes, and snippets.

@careo
Created August 18, 2009 21:40
Show Gist options
  • Select an option

  • Save careo/169994 to your computer and use it in GitHub Desktop.

Select an option

Save careo/169994 to your computer and use it in GitHub Desktop.
$stdout.sync = true
cmd = ARGV.join " "
puts "going to execute: #{cmd}"
puts "note: I'll retry the command endlessly, regardless of exit status."
puts "I will, however, wait 5 seconds before restarting to give you time"
puts "to kill me and not my subprocess"
loop do
system cmd
print "command terminated. sleeping... "
sleep 5
puts "restarting"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment