Manage variables via systemd override config #3

Merged
thib8956 merged 5 commits from systemd-override-config into master 2019-11-13 23:05:39 +00:00
5 changed files with 93 additions and 0 deletions

2
.gitignore vendored
View File

@ -3,3 +3,5 @@
!backup.timer
!exclude-list-S551LN.txt
!README.md
!Makefile
*

View File

@ -1 +1,22 @@
# Backup configuration for S551LN laptop
## Install
- run the command `make install` as admin
- in the editor that opens, write the following configuration:
```
[Service]
Environment=BORG_REPO=/path/to/borg/repo
Environment=BORG_PASSPHRASE=somEp4$sphrase
Environment=EXCLUDE_LIST=/path/to/exclude/list
```
## Uninstall
`make uninstall`
## Run manual backup
- use `systemctl start borgbackup.service` to run a backup manually
- use `journalctl -u borgbackup.service` to view the logs

12
borgbackup.service Normal file
View File

@ -0,0 +1,12 @@
[Unit]
Description=Borg backup
[Service]
Type=oneshot
Environment=BORG_HOSTNAME_IS_UNIQUE=yes
Nice=19
ExecStart=/usr/bin/borg create --list --stats --filter AME --exclude-from=${EXCLUDE_LIST} ::{now} /
ExecStartPost=/usr/bin/borg prune -v --list --keep-daily=7 --keep-weekly=4 --keep-monthly=10 --keep-within 2d --stats ::
[Install]
WantedBy=multi-user.target

9
borgbackup.timer Normal file
View File

@ -0,0 +1,9 @@
[Unit]
Description=Borgbackup
[Timer]
OnBootSec=30min
OnCalendar=0/4:00:00
[Install]
WantedBy=timers.target

49
exclude-list-S551LN.txt Normal file
View File

@ -0,0 +1,49 @@
/proc
/sys
/dev
/media
/cdrom
/tmp
/run
/var/cache
/var/tmp
/var/run
/home/*/.thumbnails
/home/*/.cache/chromium
/home/*/.cache/mozilla
/home/*/.cache/wine
/home/*/.steam/steam/steamapps
/home/*/.steam/steam/config/htmlcache
/home/*/.local/share/Trash
/home/*/.mozilla/firefox/*.default/Cache
/home/*/.gvfs
/swapfile
/var/lib/flatpak/appstream/
/var/lib/flatpak/repo/
/root/.cache
/home/*/.android
/home/*/.cache
/home/*/.m2
/home/*/.gradle
/home/*/Vidéos
/home/*/Musique
/home/*/Téléchargements
/home/*/Virtualbox_VMS
/home/*/ISO
/home/*/Android
/mnt/!data
/mnt/data/thibaud/.m2
/mnt/data/thibaud/.gradle
/mnt/data/thibaud/backups
/mnt/data/thibaud/Vidéos
/mnt/data/thibaud/Musique
/mnt/data/thibaud/Téléchargements
/mnt/data/thibaud/Virtualbox_VMS
/mnt/data/thibaud/tmp
/mnt/data/thibaud/ISO
/mnt/data/thibaud/Android
*.!qB