geoipupdate-legacy icon indicating copy to clipboard operation
geoipupdate-legacy copied to clipboard

Change exit code if files change

Open jloh opened this issue 7 years ago • 4 comments

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.

jloh avatar Oct 04 '17 11:10 jloh

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.

horgh avatar Oct 16 '17 16:10 horgh

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?

whitfin avatar Nov 02 '17 18:11 whitfin

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.

horgh avatar Nov 02 '17 19:11 horgh

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.

jloh avatar Nov 03 '17 06:11 jloh