diff --git a/ts/bobcat.classes.bobcat.ts b/ts/bobcat.classes.bobcat.ts index 0b2340e..e5cf9c9 100644 --- a/ts/bobcat.classes.bobcat.ts +++ b/ts/bobcat.classes.bobcat.ts @@ -50,6 +50,17 @@ export class Bobcat { await this.gatherMinerDetails(); if (this.latestStatus.status !== 'Synced') { console.log(`Miner ${this.latestMinerDetails.animal} is not synced. Restarting now!`); + await this.restart().catch(); } } + + public async restart() { + const response = await plugins.smartrequest.request(`http://${this.networkAddress}/admin/reboot`, { + method: 'POST', + headers: { + Authorization: 'Basic ' + Buffer.from('bobcat:miner').toString('base64') + } + }); + console.log(response.statusCode); + } } \ No newline at end of file diff --git a/ts/bobcat.classes.bobcatmanager.ts b/ts/bobcat.classes.bobcatmanager.ts index d9e16c5..758d633 100644 --- a/ts/bobcat.classes.bobcatmanager.ts +++ b/ts/bobcat.classes.bobcatmanager.ts @@ -21,4 +21,8 @@ export class BobcatManager { await bobcat.runMaintenance(); } }; + + public async restart() { + + } } \ No newline at end of file