Add cron job to retrieve device state in monitor.
|Status:||Closed||Start date:||23 Aug 2018|
|Severity:||03 - Medium|
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.
RM #669: Add root crontab to Ironman. This just pokes the monitor to retrieve device status once a minute.
#1 Updated by Hammel almost 3 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.
#3 Updated by Hammel almost 3 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.