Project

General

Profile

Actions

Feature #669

closed

Add cron job to retrieve device state in monitor.

Added by Hammel about 6 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Immediate
Assignee:
Category:
Monitor
Target version:
Start date:
23 Aug 2018
Due date:
% Done:

100%

Estimated time:
Severity:
03 - Medium

Description

I need a tool that causes imrest to retrieve device state and update it's cache. This requires a cron job or C program that is authorized to make that request. That means the API must only allow local connections (loopback). The API just iterates over registered devices, calls their get state API and the updates their cached data.


Related issues

Related to Sensors - Bug #672: deviceGet() needs to validate request by decoding itClosedHammel02 Sep 2018

Actions
Actions #1

Updated by Hammel about 6 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10

/usr/sbin/crond is available in the core platform. However, it is not started at boot time. Also, there is no /var/spool/cron directory (there is no /var/spool, for that matter).

So:
  1. Find or create (likely) an init script for crond
    1. Add it to Ironman's www packaging
  2. Create /var/spool/cron in postinst.sh in core platform.

Then I'm ready to add a cron entry to poll the REST server, eg

0-59 * * * * wget http://127.0.0.1:8165/query/devices

This needs to go into a file for root so the postinst script for the www package will have to check for the root entry. If it's there, check if this entry exists. If it's not there or the entry doesn't exist append/create the entry.

Actions #2

Updated by Hammel about 6 years ago

  • % Done changed from 10 to 30

Added cron init script to core platform Buildroot skeleton tree and pushed upstream. Tested on hardware and it works fine. The init script takes care of creating the required directories if they aren't there.

Actions #3

Updated by Hammel about 6 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 30 to 100

I simplified this just to get it done quickly. I created a root crontab file and added it to the packaging. If I ever need to extend this from another package I'll have to be more clever about iwget http://127.0.0.1:8165/query/devicest but for now, this works.

Tested, committed and pushed.

Closing issue. Note that this is just the cron entry. The support for actually doing the state updates is tracked separately.

Actions

Also available in: Atom PDF