Skip to content

Instantly share code, notes, and snippets.

@babie
Created October 20, 2013 12:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save babie/7069234 to your computer and use it in GitHub Desktop.
Save babie/7069234 to your computer and use it in GitHub Desktop.
Earthquake.init do
_ = config[:auto_restart] ||= {}
_[:interval] ||= 60 * 60
system "stty echo" # for readline
EM.defer do
sleep config[:auto_restart][:interval]
loop do
if Readline.line_buffer.nil? || Readline.line_buffer.empty?
STDOUT.print "auto "
input(":restart")
else
sleep 5
redo
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment