Skip to content

Add option to wait for the lock to unlock #444

@dotboris

Description

@dotboris

Is your feature request related to a problem? Please describe.

I have multiple cron jobs on my system that interact with autorestic and sometimes they line up and one of them crashes because the lock is already taken. Specifically, I have the following:

  • Every 5 minutes, I run autorestic cron
  • Every month, I run autorestic exec --all -- check

This month, they happened to run at the same time. autorestic cron ran and autorestic exec --all -- check crashed because the lock was already taken.

Describe the solution you'd like

I'd like there to be a CLI option for all autorestic commands that makes it wait for the lock instead of crashing right away. This would look something like this:

autorestic cron --wait-for-lock PT5M # 5 minutes is ISO 8601 format
autorestic exec --wait-for-lock PT5M --all -- check

I think that it would probably be a good idea to have an option to control how often autorestic checks to see if the lock has been released.

I'm not sure if this is a good idea but it might be helpful to be able to configure this behavior in the config file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions