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

silently fail if already running cron job? #240

Open
jmcisvt opened this issue Apr 22, 2022 · 3 comments
Open

silently fail if already running cron job? #240

jmcisvt opened this issue Apr 22, 2022 · 3 comments

Comments

@jmcisvt
Copy link

jmcisvt commented Apr 22, 2022

I would like to run osync every 5 minutes to sync local and remote changes. But I also need it to run for very long times to handle occasional huge files. My understanding is that daemon/server mode only picks up local changes. So that won't work.

I figured I could run it as a cron job every five minutes. But if it is already running I want to sliently fail and let the first process finish. I don't want to use the MAX RUNTIME timeout and keep interrupting it every 4 min 59 sec. Is there a way I can do this?

@deajan
Copy link
Owner

deajan commented Apr 22, 2022

There are two ways you can achieve what you want:

  1. Run osync target helper daemon on remote so local osync gets notified when remote file changes occur.
  2. Use the following config to make sure to exit osync if another osync instance is running: LOCAL_RUN_BEFORE_CMD="ps aux | grep \"[o]sync\" || exit 0"

If those don't fit, I could still add a EXIT_IF_OSYNC_ALREADY_RUNNING parameter

@jmcisvt
Copy link
Author

jmcisvt commented Apr 23, 2022

I just disovered the MAX_WAIT parameter. I can run in daemon mode and use MAX_WAIT set to 300 right? I think that will do what I want.

What is an osync target helper daemon? I did not see this in the documentation.

@deajan
Copy link
Owner

deajan commented May 5, 2022

Documentation isn't updated at the moment for v1.3RC2 which is the git master version.
osync target helper daemon is a service installed on targets in order to detect FS changes and notify initiator which will trigger a sync run.

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

No branches or pull requests

2 participants