geoipupdate-legacy
geoipupdate-legacy copied to clipboard
Change exit code if files change
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.
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.
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?
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.
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.