Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use flock for cron commands #12181

Open
frafra opened this issue Apr 25, 2024 · 1 comment
Open

Use flock for cron commands #12181

frafra opened this issue Apr 25, 2024 · 1 comment

Comments

@frafra
Copy link
Contributor

frafra commented Apr 25, 2024

# */1 * * * * /usr/src/geonode/manage.sh collect_metrics -n -t xml >> /var/log/cron.log 2>&1
# 0 * * * * /usr/src/geonode/manage.sh dispatch_metrics >> /var/log/cron.log 2>&1

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
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants