Last active
August 29, 2015 14:26
-
-
Save djvs/37cb5dc7047a431c51ad to your computer and use it in GitHub Desktop.
Ubuntu neo4j uptime watcher (alpha)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'timeout' | |
def restartneo4j | |
puts "restarting neo4j" | |
`sudo service neo4j-service restart"` | |
end | |
begin | |
Timeout::timeout(5){ | |
@output = `curl http://localhost:7474` | |
} | |
if [email protected]?("management") # server responds incorrectly | |
restartneo4j | |
else # server responds correctly | |
puts @output.inspect | |
puts "everything is ok" | |
end | |
rescue # server does not respond | |
restartneo4j | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment