What's the `update-status` Interval?

According to the docs:

Is this like like every 30 seconds, every few minutes, or more like every half-hour? Or does it depend?

I assume I shouldn’t rely on it for anything that requires critical timing, but I wanted to make sure it was suitable for something that needs to happen at least once-per-day and it doesn’t matter if it happens more often.

Update status runs in around a 5min interval. It’s tweaked so that not all units will flood at the same window.

As far as using it for automated things I’d suggest actually adding/managing a cron.d script as you’ll get something that’s more sustainable and using system logging/etc vs something running as root in the charm.

Cool thanks.

I actually need it to run in the charm because I need to check for changes to certificates and update relations if necessary. Eventually I think I’m going to add a cron scheduler to the Lucky daemon for stuff like this, but at the moment update-status should work fine.

It’s also configurable within the model.

Run: $ juju model-config

There is a config option in there that allows you to modify it.

2 Likes

It’s the update-status-hook-interval configuration parameter:

update-status-hook-interval:
 type: string
 description: |
  How often to run the charm update-status hook, 
  in human-readable time format (default 5m, range 1-60m)

From juju help model-config

2 Likes

It’s actually possible to run things, via cron, within the charm’s context! You can see an example of a charm doing this in the glance-simplestreams-sync charm. There’s a python script that’s run via cron and does things like set unit status, querying relation data, and even updating relations!

5 Likes

That’s quite the hack. Nice work!