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

fix: cli command to unlock the autorestic running value #329

Merged
merged 3 commits into from
Mar 12, 2024

Conversation

rwxd
Copy link
Contributor

@rwxd rwxd commented Oct 10, 2023

Hi, thanks for the awesome tool.

I had the case where the .autorestic.lock.yml had the running key to true but there was no instance running.

This pull request adds the unlock command which just unlocks. Additionally a page to the documentation is added.

Example:

❯ go run main.go unlock
Using config:    /home/user/.autorestic.yaml
Using lock:      /home/user/.autorestic.lock.yml
Unlock successful
❯ cat ~/.autorestic.lock.yml | grep running
running: false

I don't know if "fix:" is the right commit, I can rewrite the commit with "feat:" in case it fits better.

@vercel
Copy link

vercel bot commented Oct 10, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
autorestic ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 10, 2023 7:26pm

@rwxd rwxd changed the title fix: Cli command to break the lock fix: cli command to break the lock Oct 10, 2023
@rwxd rwxd changed the title fix: cli command to break the lock fix: cli command to unlock the autorestic running value Oct 10, 2023
@cupcakearmy
Copy link
Owner

super cool, thanks :)
In the docs you already showed how to check if autorestic is running, do we want to add that check into the code itself?

@rwxd
Copy link
Contributor Author

rwxd commented Oct 10, 2023

super cool, thanks :) In the docs you already showed how to check if autorestic is running, do we want to add that check into the code itself?

That is a good idea.

I modified the source code a bit so that the running processes will be checked. In case there is an autorestc process running, the user will get warned and has the option to abort or write yes to still unlock the lock.

No process running

❯ go run main.go unlock
Using config:    /home/user/.autorestic.yaml
Using lock:      /home/user/.autorestic.lock.yml
Unlock successful

Process running, aborting with no

❯ go run main.go unlock
Using config:    /home/user/.autorestic.yaml
Found autorestic processes:
root       61997  0.0  0.0 1236056 7472 pts/7    Sl+  20:45   0:00 autorestic --ci backup -a
Another autorestic instance is running. Are you sure you want to unlock? (yes/no): no
Unlocking aborted.

Processing running, continue with yes

❯ go run main.go unlock
Using config:    /home/user/.autorestic.yaml
Found autorestic processes:
root       61997  0.0  0.0 1236056 7472 pts/7    Sl+  20:45   0:00 autorestic --ci backup -a
Another autorestic instance is running. Are you sure you want to unlock? (yes/no): yes
Using lock:      /home/user/.autorestic.lock.yml
Unlock successful

@cupcakearmy cupcakearmy merged commit 12f6143 into cupcakearmy:master Mar 12, 2024
1 check passed
@bin101
Copy link

bin101 commented Mar 12, 2024

@rwxd @cupcakearmy
The unlock check now also detects the unlock process, e.g.:

❯ autorestic unlock
Using config: 	 /root/.autorestic.yml
Found autorestic processes:
root     2834763  0.0  0.0 1232972 5632 pts/0    Sl+  15:51   0:00 autorestic unlock
Another autorestic instance is running. Are you sure you want to unlock? (yes/no):

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

Successfully merging this pull request may close these issues.

3 participants