Results 1 to 4 of 4

Thread: Cortex 'uptime'

  1. #1
    Automated Home Sr Member mcockerell's Avatar
    Join Date
    Jan 2009
    Posts
    68

    Default Cortex 'uptime'

    The batch files that run when our Cortex server starts up write entries in a log file recording the date and time of each event; over the years this has proven useful when investigating problems, such as when the server reboots unexpectedly.
    Recently I decided that it would be helpful to have the latest boot date/time available on a Notice Board rather than having to login to the server and view the logfile. So I started to look at ways of presenting the information so that I could get it via the app on my Android device. I realised that the ideal would be to present a built-in object that held the Cortex start date/time, but that doesn't seem to exist, so I had to construct something similar myself.
    I modified a batch file to write the boot date and time to a file 'index.html' in JSON format, set-up a copy of the TinyWeb web server on port 8000 and added a Cortex Web Client API object to read the website at 127.0.0.1 - I now had the information I wanted in a Cortex object that I could present on the Notice Board.

    The index.html file looks like this:
    {
    "At":"17:40:47 on 10-03-2019"
    }

    When decoded this gives me a Cortex object called "Server Boot At Response 0" under "Web API Client".
    I have added the entry 'Server booted at <Web API Client.Server Boot At Response 0=$0>' to "All Display" and connected this to "Martin Notice Board - New Message in" to display a formatted message - it is triggered by the 'Server Boot Finished' signal from the 'Web API Client'.

    In order to force the message to be sticky on the Notice Board I send an event to the Web Client API Server Boot Send trigger every 15 minutes.

    Although this seems to be working as desired I do have a couple of questions:

    1) Is there an easier way of doing this?
    2) Is there an existing Cortex object that I could have used instead?

  2. #2
    Automated Home Legend chris_j_hunter's Avatar
    Join Date
    Dec 2007
    Location
    North Lancashire
    Posts
    1,668

    Default

    short answer is yes ...

    have a look at the connections available for World ...

    we use its On Initialise Complete connection to provoke announcement of Cortex relaunches via Sound & via AllDisplay ...

    our messages including <Time> & other inserts to say when it happened etc ...


    Chris

    PS: many thanks for posting detail on your approach - could help with some other things we're looking to include ...

  3. #3
    Automated Home Sr Member mcockerell's Avatar
    Join Date
    Jan 2009
    Posts
    68

    Default

    Thanks, I hadn't seen those connection possibilities.
    However, On Initialise Complete only seems to offer 'Annunciate' options, and I'm looking for message output - am I missing something?

  4. #4
    Automated Home Legend chris_j_hunter's Avatar
    Join Date
    Dec 2007
    Location
    North Lancashire
    Posts
    1,668

    Default

    ours is connected like this :

    World ... On Initialise Complete ... AllDisplay - CortexRunning Update Text Line

    AllDisplay ... Behaviour ... Name CortexRunning / DisplayText as you choose

    AllDisplay ... Connections ... CortexRunning Update Text Line - World / On Initialise Complete

    AllDisplay ... Connections ... CortexRunning Text Line Output - as follows :

    . Sound - Speak Text in Broadcast
    . NoticeBoard - New Message in
    . SystemMessages - Event Message in tray

    HTH

    Chris

Posting Permissions

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