Results 1 to 1 of 1

Thread: Graceful shutdown prior to loadshedding

  1. #1
    Senior Member psuno's Avatar
    Join Date
    Nov 2007
    Posts
    992
    Experience

    Default Graceful shutdown prior to loadshedding

    USE NODE.JS and NPM packages to get Loadshedding Status and power down your rig safely before power cuts!

    So I screwed around with Ubuntu, and made a very slap dash script that shuts down the PC 5 minutes prior to loadshedding kicking in by using a Node.js npm API package called eskom-loadshedding-api

    Eskom Loadshedding API located at the following URL:
    https://www.npmjs.com/package/eskom-loadshedding-api

    I only used this bit from the NPM package and saved it to a .js file:

    import { Status, LoadsheddingStage } from 'eskom-loadshedding-api';

    Status.getStatus().then((status = LoadsheddingStage) => console.log(status));

    You run it like this: node -r esm yourApp.js, it returns an integer (loadshedding stage) and you can build logic into an OS of your choice script which will shut down depending on the schedule stage.

    (I had to install the esm package from npm as well to get it to work.)
    https://www.npmjs.com/package/esm

    You guys are welcome to explore that eskom-loadshedding-api, there's a ton of info you can extract from it and make your rig act accordingly.
    Last edited by psuno; February 3rd, 2020 at 09:36 PM.
    Games: Oblivion Platinum, LBP, RB6V2, SFIV, Turok, GRAW2


    gaming informed.

  2. Saying Thanks:

    Row-_S (February 4th, 2020)  

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •