Feature #669
closedAdd cron job to retrieve device state in monitor.
100%
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
Updated by Hammel over 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:- Find or create (likely) an init script for crond
- Add it to Ironman's www packaging
- 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.
Updated by Hammel over 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.
Updated by Hammel over 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.