Skip to content

Instantly share code, notes, and snippets.

@milligramme
Forked from babie/auto_restart.rb
Last active December 26, 2015 09:49
Show Gist options
  • Save milligramme/7132281 to your computer and use it in GitHub Desktop.
Save milligramme/7132281 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 ".c([5,91])
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