Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// check-openbazaar-server.js
var exec = require('child_process').exec;
console.log('openbazaar server check is ON');
var check = function() {
exec("curl -I -m 10 http://localhost:18469 2> /dev/null", function (err, stdout, stderr) {
if (err || stderr) {
console.log('Kill at: '+new Date());
console.log(err,stderr)
exec('docker rm -f observer && sh /your/path/openbazaar-server.sh', function (err, stdout, stderr){
console.log(stdout)
})
return;
}
if (stdout.search("HTTP") >= 0) {
// ok
} else {
// ???
console.log('unknown response')
}
});
}
// main
check()
setInterval(
check
,200*1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment