GeoNode / geonode

GeoNode is an open source platform that facilitates the creation, sharing, and collaborative use of geospatial data.
https://geonode.org/
Other
1.43k stars 1.12k forks source link

Use flock for cron commands #12181

Open frafra opened 4 months ago

frafra commented 4 months ago

https://github.com/GeoNode/geonode/blob/3d6ab6e0a5e536fecf75b28242d0301526f01e58/monitoring-cron#L1-L2

There is the remote possibility that these commands are executed more than once (it can happen that collect_metrics needs more than a minute on an overloaded server sometimes). I would suggest using flock -n lockfile command to avoid that and skip the execution if the process is running. Something like this:

# */1 * * * * flock -n /tmp/collect_metrics.lock /usr/src/geonode/manage.sh collect_metrics -n -t xml >> /var/log/cron.log 2>&1
# 0 * * * * flock -n /tmp/dispatch_metrics.lock /usr/src/geonode/manage.sh dispatch_metrics >> /var/log/cron.log 2>&1
giohappy commented 4 months ago

@frafra the monitoring architecture is considered deprecated and obsolete, for several reasons. That cron is not executed, unless you enable it inside the Dockerfile