Manage variables via systemd override config #4

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

3
.gitignore vendored
View File

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

13
Makefile Normal file
View File

@ -0,0 +1,13 @@
systemd_path := /etc/systemd/system
install:
cp borgbackup.* $(systemd_path)/
chmod a+x $(systemd_path)/borgbackup.*
systemctl edit borgbackup.service
systemctl enable borgbackup.timer
systemctl start borgbackup.timer
uninstall:
systemctl disable borgbackup.timer
rm -rvf $(systemd_path)/borgbackup.service
rm -rvf $(systemd_path)/borgbackup.timer
rm -rvf /etc/systemd/system/borgbackup.service.d

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