maxmind / geoipupdate-legacy

GeoIP update client code
GNU General Public License v2.0
258 stars 63 forks source link

Change exit code if files change #73

Open jloh opened 6 years ago

jloh commented 6 years ago

For use with cron it'd be great if geoipupdate exited with a non-zero status if a DB changed so relevant services could be reloaded.

horgh commented 6 years ago

That's a good idea. We do exit non-zero (1) already if there is an error, so I think this would need to be configurable and default off.

whitfin commented 6 years ago

I'm not sure that's the best way to do it seeing as 0 denotes success (plus who knows how many people are relying on that 0 at this point?). It might be better to emit something to stdout that can be listened for instead?

horgh commented 6 years ago

Yes, altering the exit status on success would definitely have to be opt in for the reasons you mention.

Writing something out to indicate this could work too. Possibly a kind of status report. This would again need to be opt in though.

I'm leaning towards thinking this type of thing should be done outside of geoipupdate. For example, you could check the md5sums of databases before and after running it, and prod whatever depends on them to reload if there's a change. That would keep geoipupdate simple too.

jloh commented 6 years ago

My basic idea is just for automation since at the moment there isn't any way to tell whether a database has been updated easily so you can reload services.