Compare commits

...

5 Commits

Author SHA1 Message Date
James Tyra
958208f5b0
Merge 5b4a2c3165 into fc8b5fdbe2 2023-10-02 14:46:23 +02:00
Vladimir Mikryukov
fc8b5fdbe2
fix typos in cron.md (#316) 2023-10-02 14:10:51 +02:00
Christoph Loy
f67bb7f73c
Bump version to 1.7.9 (#325) 2023-10-02 14:09:34 +02:00
Christoph Loy
530b1b646c
Update restic to 0.16.0 (#324) 2023-10-02 11:08:28 +02:00
James Tyra
5b4a2c3165
Update cron.md
crontab entries need a user. 
When copying and pasting the examples directly into my crontab, they were not running. Using a crontab checking utility, an error was generated:
`Checking correctness of /var/spool/cron/crontabs/root
E: 6: */5 * * * * /usr/local/bin/autorestic -v -c /root/.autorestic.yml --ci cron |& /usr/bin/logger -t autorestic > /dev/null 2>&1
e:    INVALID_USER: Invalid username "/usr/local/bin/autorestic"
E: There were 1 errors and 0 warnings.`

This update adds a username (root) to the example, which fixes the syntax error.
2023-04-06 11:42:13 -05:00
3 changed files with 9 additions and 9 deletions

View File

@ -6,7 +6,7 @@ RUN go mod download
COPY . . COPY . .
RUN go build RUN go build
FROM restic/restic:0.15.1 FROM restic/restic:0.16.0
RUN apk add --no-cache rclone bash RUN apk add --no-cache rclone bash
COPY --from=builder /app/autorestic /usr/bin/autorestic COPY --from=builder /app/autorestic /usr/bin/autorestic
ENTRYPOINT [] ENTRYPOINT []

View File

@ -1,6 +1,6 @@
# Cron # Cron
Often it is usefully to trigger backups automatically. For this we can specify a `cron` attribute to each location. Often it is useful to trigger backups automatically. For this, we can specify a `cron` attribute to each location.
```yaml | .autorestic.yml ```yaml | .autorestic.yml
locations: locations:
@ -10,15 +10,15 @@ locations:
cron: '0 3 * * 0' # Every Sunday at 3:00 cron: '0 3 * * 0' # Every Sunday at 3:00
``` ```
Here is a awesome website with [some examples](https://crontab.guru/examples.html) and an [explorer](https://crontab.guru/) Here is an awesome website with [some examples](https://crontab.guru/examples.html) and an [explorer](https://crontab.guru/).
## Installing the cron ## Installing the cron
**This has to be done only once, regardless of now many cron jobs you have in your config file.** **This has to be done only once, regardless of how many cron jobs you have in your config file.**
To actually enable cron jobs you need something to call `autorestic cron` on a timed schedule. To actually enable cron jobs you need something to call `autorestic cron` on a timed schedule.
Note that the schedule has nothing to do with the `cron` attribute in each location. Note that the schedule has nothing to do with the `cron` attribute in each location.
My advise would be to trigger the command every 5min, but if you have a cronjob that runs only once a week, it's probably enough to schedule it once a day. My advice would be to trigger the command every 5min, but if you have a cronjob that runs only once a week, it's probably enough to schedule it once a day.
### Crontab ### Crontab
@ -37,7 +37,7 @@ Then paste this at the bottom of the file and save it. Note that in this specifi
PATH="/usr/local/bin:/usr/bin:/bin" PATH="/usr/local/bin:/usr/bin:/bin"
# Example running every 5 minutes # Example running every 5 minutes
*/5 * * * * autorestic -c /path/to/my/.autorestic.yml --ci cron */5 * * * * root autorestic -c /path/to/my/.autorestic.yml --ci cron
``` ```
> The `--ci` option is not required, but recommended > The `--ci` option is not required, but recommended
@ -45,11 +45,11 @@ PATH="/usr/local/bin:/usr/bin:/bin"
To debug a cron job you can use To debug a cron job you can use
```bash ```bash
*/5 * * * * autorestic -c /path/to/my/.autorestic.yml --ci cron > /tmp/autorestic.log 2>&1 */5 * * * * root autorestic -c /path/to/my/.autorestic.yml --ci cron > /tmp/autorestic.log 2>&1
``` ```
Now you can add as many `cron` attributes as you wish in the config file ⏱ Now you can add as many `cron` attributes as you wish in the config file ⏱
> Also note that manually triggered backups with `autorestic backup` will not influence the cron timeline, they are willingly not linked. > Also note that manually triggered backups with `autorestic backup` will not influence the cron timeline, they are intentionally not linked.
> :ToCPrevNext > :ToCPrevNext

View File

@ -17,7 +17,7 @@ import (
"github.com/spf13/viper" "github.com/spf13/viper"
) )
const VERSION = "1.7.7" const VERSION = "1.7.9"
type OptionMap map[string][]interface{} type OptionMap map[string][]interface{}
type Options map[string]OptionMap type Options map[string]OptionMap