Comments (13)
Yes, this is truly needed.
As the repo you posted, I think systemd timers might be the best solution for this.
Do you know any good libraries to automate this? I've searched npm a bit but have not found anything. Otherwise I'll write it myself.
Also there should be a decision to run the entire file, or more granularly a location at the time. I think being able to decide which location should be backed up manually is better. What do you think?
from autorestic.
I am not sure about the libraries that may be needed. I am not very conversant in that regard. However, I will try giving a search on my own end.
I think being able to decide which location should be backed up manually is better.
I believe the above should be a priority as this would afford more configuration power to the users and would possibly also cover the first scenario by way of individually adding all the configured locations to be backed up at once if somebody desired.
from autorestic.
I've not found a library, so I think this will be needed to be coded by hand.
Maybe the best option is to have a systemd timer that runs a custom autorestic command every 5 min or so, and the autorestic will have a lock/log file, where it checks for all locations and decides for each individually if backup is needed. Creating a timer for each location that wants an automatic backup i think is way to complicated
from autorestic.
Will try some stuff this weekend :)
from autorestic.
Also, not relying on systemd for the single timers for the individual locations make it way more flexible if in future one would like to support more than systemd triggers. Basically then one only needs to have something triggering autorestic cron
e.g. every x minutes
from autorestic.
autorestic cron
is ready. Now we need a method for triggering the command
from autorestic.
@aanjaneyam see the new docs :)
https://cupcakearmy.github.io/autorestic/location/cron
from autorestic.
@cupcakearmy thanks for all the efforts you have made. Looks promising. I understand systemd implementation would have been more dynamic/flexible albeit a bit complex. But cron would also do the job. However, I have one point to make regarding home laptops which are not switched on all the time. I was wondering the above implementation could use anacron or similar for devices which are not always on.
from autorestic.
@aanjaneyam I'm not very familiar with anacron, so I don't know about that, however:
There is no need for any service to be running all the time. Basically any programm/sheduler/cron/whatever can call autorestic -f ./myconfig.yml cron
whenever it wishes to. Then autorestic simply checks if since the last time it was called there is a need to do a backup or not. The only advantage of running the cron
command more frequently is that you will get more accurate backups regarding your target.
An example maybe:
Say you have this cron job cron: 0 3 * * *
(every day at 3 in the morning)
You call autorestic cron
on monday at 10:00. Since there has been no backup before -> will make a backup.
You call autorestic cron
on tuesday at 2:00 -> no backup since it's before the deadline
You call autorestic cron
on tuesday at 5:00 -> backup, since there should have been one at 3:00
You call autorestic cron
on tuesday 19:00 -> no backup
You call autorestic cron
on friday 4:00 -> backup, but only one, it will not do 3 backups, even if you skipped a few days.
I hope this helps :)
from autorestic.
@cupcakearmy So you mean to say we just need to call the command autorestic -f ./myconfig.yml cron
(aka 'autorestic cron' command pointing to a particular configfile.yml where cron attribute is defined) in whatever way we can.
So I guess the only thing needed would be to somehow to run the above command at regular intervals using a combination of systemd service and timers. However, I am unsure here, when implemented as systemd units would the units be actually calling the cron attribute which in turn would call the cron schedule defined in crontab. If this is the case then it would be using both systemd and cron which may not help simplicity. I may become more clear if you could clarify what is the difference between cron attribute and cron schedule in crontab and would they stand along with systemd units.
I will try to search to see how autorestic -f ./myconfig.yml cron
command can be implemented with a combination of systemd. A quick look on google came up with this https://github.com/larsks/restic-systemd-units . Though I am not sure how these ready-made units could help us.
In the meantime, I would also like to share following articles from the excellent resource named arch wiki (arch wiki is my first go to if I want to learn anything about Linux which I don't know.)
https://wiki.archlinux.org/index.php/Cron#Asynchronous_job_processing
https://wiki.archlinux.org/index.php/Systemd/Timers
from autorestic.
Exactly, "something" simply need to call the command.
Systemd timers do definitely work. :) yes the arch wiki is always amazing xD.
If you code the systemd version I will happily include id in the docs
from autorestic.
@cupcakearmy It appears that I cannot navigate to the detailed docs of autorestic. It appears to have changed to .html format but can't find links until I manually find and complete URL like https://cupcakearmy.github.io/autorestic/config
OR https://cupcakearmy.github.io/autorestic/location/forget
Also what is that -c flag used in the crontab line.
Also it appears in archlinux it there is nothing like cron installed by default. Their archwiki cron page states - There are many cron implementations, but none of them ar installed by default as the base system uses systemd/Timers instead.
So will need to figure out the best implementation.
from autorestic.
Thats weird.. work on my side in Firefox, Vivaldi and Safari.
I made a mistake above. I ment -c
instead of -f
. -f
is not a flag. -c
is for specifing a config file. By default autorestic looks for a .autorestic.yml
in the current directory or in your home folder. since cron jobs don't spawn where you config is, you need to specify t manually. :)
I'm super busy right now, if I find some time I could look at the systemd equivalent, but tbh it should be a matter of max an hour. systemd is well documented.
from autorestic.
Related Issues (20)
- Info command prints out secret keys
- Hooks to have access to location path HOT 1
- Cron updates timestamp even when backup fails
- `uninstall` command is broken
- Docker compose example in the docker installation guide
- 'locations[storage]' has invalid keys: forgetoption HOT 4
- Keep up with restic releases HOT 1
- Restic repository not initialized by default in GCP
- Bug: Docker volume backup to B2 fails ("context deadline exceeded") HOT 1
- forget dryRun is always false on backup task
- Support backing up Docker volumes via the REST backend
- autorestic running backup.yml,restic print 'unknown flag: --use-fs-snapshot' HOT 1
- Copy a repo
- Add a cron option to the forget/prune policies
- Suggestion: don't require 'from' key in locations that use include arguments.
- $PATH being ignored by autorestic HOT 4
- Showing during the backup the progress in percentage of every single location
- Add more verbose error messages HOT 4
- Flag locations as paused
- Error when running as docker container
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from autorestic.