Commit Graph

36 Commits

Author SHA1 Message Date
Erik Westrup
ab928d0dfd Rename *.env files to *.env.sh
Fixes #66
2022-02-08 17:26:08 +01:00
Erik Westrup
6c1d182e21 Only sleep in service if other restic running 2022-02-08 17:13:26 +01:00
Erik Westrup
645df1a0d4 Move /sbin to /bin
As more users would have /bin than /sbin in their PATH
2022-02-07 18:22:36 +01:00
Erik Westrup
9760cd05ec Truly support custom PREFIX= install
* Before, doing `$ PREFIX=/usr/local make install` would install files to`/usr/local/usr/local..` which is wrong
* With this PR, files will be installed to the expected location e.g. `/usr/local/etc/restic`
* `Makefile` almost completely rewritten
   * As e.g. `default.env` would source `_global.env`, `default.env` must be edited to find the right location of `_global.env` depending on what `$PREFIX` was set to.
   * see documented build stages in the `Makefile` itself.
   *  Made sure that the rules are correct so that only modifed files are installed, not all at once unnecessarily like before.
* A sub-goal was that the [PKGBUILD](https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=restic-systemd-automatic-backup#n20) for Arch should not need to do any custom install configuration, to keep everything easier to maintain. `$ make install` should work out of the box for Arch.
* Additionally added the `-b` flag to `install(1)` that makes a backup of existing `etc/restic/*` files before installing a newer version.

Fixes #49
2022-02-03 20:52:00 +01:00
Gerard Bosch
3852e305b6 Add resticw (restic wrapper) utility (#60)
The script provides a convenient way to load environment config, deal
with profiles and act as a pass-through to restic. The overall thing is
to improve the UX when running restic, integrating the features this
project provides.

## Note

The script itself is a very simple thing.
The command line parser is auto-generated using docopt.sh driven from
the script's DOC. It can be refreshed upon DOC changes with:
`docopt.sh path/to/resticw`.

## How to use it

### Examples

```console
sudo resticw stats latest

sudo resticw -p profileA snapshots
```

### Help

```console
❯ resticw --help
A little wrapper over restic just to handle profiles and environment loading.

  It loads the backup profile/environment in a subshell to avoid any credential leak (Note: Run it with sudo so it can load the environment).

  Usage:
    resticw [options] <restic_arguments>

    The restic_arguments is just the regular unwrapped restic arguments, e.g. stats latest

  Options:
    -p --profile=<name>        Specify the profile to load or use default [default: default].

  Examples:
    sudo resticw --profile profileA snapshots
    sudo resticw stats latest  # this will use the profile: default
```



Co-authored-by: Erik Westrup <erik.westrup@gmail.com>
2022-02-03 20:40:45 +01:00
Erik Westrup
dd073dfc73 Fix arguments by using arrays to buildup 2022-02-01 19:24:38 +01:00
Erik Westrup
b23d552f0b Allow set but empty envvars 2022-02-01 18:31:27 +01:00
Erik Westrup
7808dd6ecc Revert "Test that lint fails"
This reverts commit 082089a203.
2022-02-01 18:04:37 +01:00
Erik Westrup
082089a203 Test that lint fails 2022-02-01 18:03:11 +01:00
Erik Westrup
33a16ddb75 Modified: usr/local/sbin/restic_backup.sh 2022-02-01 17:20:30 +01:00
Erik Westrup
9b7db6d999 Run shellcheck on all shellscripts 2022-02-01 17:15:47 +01:00
Erik Westrup
79d13a1e64 Prefix envvars with RESTIC_ for consistencty
Fix #63
2022-02-01 16:59:12 +01:00
Erik Westrup
4e8b8adff6 Rename backup_exclude to backup_exclude.txt
Fixes #64
2022-02-01 16:52:20 +01:00
Erik Westrup
687111fddf Assert that all envvars are set in scripts
Remind user to source profile before executing.

Fixes #62
2022-02-01 16:45:19 +01:00
Erik Westrup
f4b90c2499 Add RESTIC_VERBOSITY_LEVEL
Fixes #50
2022-02-01 16:19:05 +01:00
Erik Westrup
341f3e79ec Allow extra args to restic-backup with RESTIC_BACKUP_EXTRA_ARGS
Fixes #56
2022-02-01 16:15:18 +01:00
Gerard Bosch
d8f25cdf88 Multiple profile configuration (#45)
Adds possibility to have multiple profiles with different backup paths, retention etc.

Co-authored-by: Matt Feifarek <matt.feifarek@gmail.com>
Co-authored-by: Erik Westrup <erik.westrup@gmail.com>
2022-02-01 10:09:36 +01:00
Erik Westrup
1d1145296d Add comment explaining dynamic backup path
Fixes #42
2021-12-04 18:38:34 +01:00
Martin Michlmayr
4bb30eee90 Fix typo in script 2019-09-23 10:45:38 +02:00
Todd E Johnson
429ee40220 Add b2 connection limit to forget now that it prunes. 2019-07-31 22:59:03 -05:00
Todd E Johnson
be5c07bd0f Update comment describing restic-forget to note prune 2019-07-31 22:56:24 -05:00
Todd E Johnson
197b4b7064 Forget now has --prune which might be more efficent. 2019-07-25 22:51:07 -05:00
Todd E Johnson
5751d90020 Add checks to see if dbus and NetworkManager are running 2019-07-23 12:15:39 -05:00
Todd E Johnson
d8c0a8d2d6 Add nm-unmetered-connection checks 2019-07-15 20:45:24 -05:00
Todd E Johnson
c065dc029b Merge changes from #19 2019-07-13 10:35:40 -05:00
Todd E Johnson
e3f01b7911 Move /.backup_exlude to /etc/restic/backup_exclude 2019-07-13 00:09:58 -05:00
Todd E Johnson
ea133c823f Fix missing directories on install 2019-07-12 23:16:58 -05:00
Bill Kaguru Wanjohi
91c5b98f85 typos 2019-04-26 14:35:51 +00:00
Erik Westrup
ba732cb238 Increase network connections to B2 2018-11-24 13:27:59 +01:00
Erik Westrup
960cc9d42f Execute restic verbose fore better loggig 2018-08-26 17:04:49 +02:00
Erik Westrup
f50055f26a Let journalctl be the log file maintainer
Fixes #3
2018-08-26 15:54:35 +02:00
Erik Westrup
8d023d0fe1 Forget groups hosts together 2018-08-02 00:19:36 +02:00
Erik Westrup
47a129d2c6 Added cron example for FreeBSD 2018-07-01 10:59:11 +02:00
Erik Westrup
d90a087537 Spell fix 2018-05-29 16:03:30 +02:00
Erik Westrup
b8597b4437 --one-filesystem bug is now fixed in restic 0.9.0 2018-05-29 16:02:25 +02:00
Erik Westrup
6b3a3a7773 Put files in directory structure 2018-04-13 20:39:24 +02:00