Created
December 18, 2019 04:45
-
-
Save AndrewWestberg/a576af1ebfa95fd87226bd249a2a84f0 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
cd /home/USERNAME/cardano | |
BLOCK_HASH=`/home/USERNAME/.cargo/bin/jcli rest v0 node stats get --host http://127.0.0.1:3100/api | grep 'lastBlockHash:' | sed -e 's/^[[:space:]]*//' | sed -e 's/lastBlockHash: //'` | |
FOUND=`/usr/bin/node /home/USERNAME/cardano/check_for_block.js $BLOCK_HASH` | |
if [[ "$FOUND" -eq 1 ]]; then | |
echo "`date`: Block Found!!" | |
else | |
echo "`date`: Block Not Found!! $BLOCK_HASH" | mail -s "Jormungandr Error" ###########@msg.fi.google.com | |
fi |
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
'use strict'; | |
const puppeteer = require('puppeteer'); | |
(async() => { | |
const browser = await puppeteer.launch(); | |
const page = await browser.newPage(); | |
//let block_hash = 'fcaf44a6dd85848df400185e264e5b5a43df719a2a63f2f31164c52440110899'; | |
let block_hash = process.argv[2]; | |
let url = 'https://shelleyexplorer.cardano.org/en/block/'+block_hash+'/'; | |
await page.goto(url, {waitUntil: 'networkidle2'}); | |
await page.waitFor(3000); | |
const found = (await page.content()).match(new RegExp(block_hash,'gi')) ? '1' : '0'; | |
console.log(found); | |
await browser.close(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment