Add plain restic example

This commit is contained in:
Alexander Schäferdiek 2022-06-05 01:09:23 +02:00
parent a81649d4c4
commit 1d1aee1c6a
15 changed files with 121 additions and 7 deletions

View file

@ -0,0 +1,16 @@
[Unit]
Description=Run restic check script for %I utilizing ~/.config/restic/%I-check.sh file using env ~/.config/restic/%I.env
OnFailure=systemd_failure_notify@%n.service
Wants=network-online.target
After=network-online.target
Requires=network-online.target
[Service]
Type=oneshot
ExecStart=sh %h/.config/restic/%I-check.sh
Environment="PATH=/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:%h/.bin"
Environment="SSH_AUTH_SOCK=/run/user/%u/keyring/ssh"
EnvironmentFile=%h/.config/restic/%I.env
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,9 @@
[Unit]
Description=Run restic check script for %I utilizing HOME/.config/restic/%I-check.sh file
[Timer]
OnCalendar=Wed 22:00:00
Persistent=false
[Install]
WantedBy=timers.target

View file

@ -0,0 +1,16 @@
[Unit]
Description=Run restic create script for %I utilizing ~/.config/restic/%I-create.sh file using env ~/.config/restic/%I.env
OnFailure=systemd_failure_notify@%n.service
Wants=network-online.target
After=network-online.target
Requires=network-online.target
[Service]
Type=oneshot
ExecStart=sh %h/.config/restic/%I-create.sh
Environment="PATH=/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:%h/.bin"
Environment="SSH_AUTH_SOCK=/run/user/%u/keyring/ssh"
EnvironmentFile=%h/.config/restic/%I.env
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,9 @@
[Unit]
Description=Run restic create script for %I utilizing HOME/.config/restic/%I-create.sh file
[Timer]
OnCalendar=23:00
Persistent=false
[Install]
WantedBy=timers.target

View file

@ -0,0 +1,16 @@
[Unit]
Description=Run restic check script for %I utilizing ~/.config/restic/%I-check.sh file using env ~/.config/restic/%I.env
OnFailure=systemd_failure_notify@%n.service
Wants=network-online.target
After=network-online.target
Requires=network-online.target
[Service]
Type=oneshot
ExecStart=sh %h/.config/restic/%I-check.sh
Environment="PATH=/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:%h/.bin"
Environment="SSH_AUTH_SOCK=/run/user/%u/keyring/ssh"
EnvironmentFile=%h/.config/restic/%I.env
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,9 @@
[Unit]
Description=Run restic prune script for %I utilizing HOME/.config/restic/%I-prune.sh file
[Timer]
OnCalendar=Wed 23:00:00
Persistent=false
[Install]
WantedBy=timers.target

View file

@ -1,12 +1,15 @@
[Unit]
Description=Run resticwrapper
#OnFailure=systemd_failure_notify@%n.service
OnFailure=systemd_failure_notify@%n.service
Wants=network-online.target
After=network-online.target
Requires=network-online.target
[Service]
Type=oneshot
ExecStart=resticwrapper
#ExecStart=borgwrapper /home/myUser/resticwrapper-custom.conf
#Environment="SSH_AUTH_SOCK=/run/user/myUserId/keyring/ssh"
Environment="PATH=/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:%h/.bin"
Environment="SSH_AUTH_SOCK=/run/user/%u/keyring/ssh"
[Install]
WantedBy=default.target
WantedBy=multi-user.target

View file

@ -2,7 +2,7 @@
Description=Run resticwrapper
[Timer]
OnCalendar=20:00
OnCalendar=23:00
Persistent=false
[Install]

4
sync
View file

@ -15,7 +15,7 @@ usage() {
echo "";
echo "- Press 4 to list command line users for sync";
echo "";
echo "- Press 5 to sync the git folder's '/usr/local/bin' with system's '/usr/local/bin'";
echo "- Press 5 to sync the git folder's '/usr' with system's '/usr'";
echo "---";
echo "Press 0 or [CTRL+C] to exit";
}
@ -100,7 +100,7 @@ menu() {
echo $u;
done
elif [ "$menuInput" = "5" ]; then
sudo rsync -r -t -v --chown=root:root --progress $(pwd)/usr/local/bin/ /usr/local/bin/
sudo rsync -r -t -v --chown=root:root --progress $(pwd)/usr/ /usr/
echo "";
elif [ "$menuInput" = "0" ]; then
exit 0;

View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
/usr/bin/restic check

View file

@ -0,0 +1,11 @@
#!/usr/bin/env bash
/usr/bin/restic backup \
--one-file-system \
--exclude-file /home/myuser/.config/restic/mybackup.exclude \
--files-from /home/myuser/.config/restic/mybackup.include
/usr/bin/restic forget \
--keep-daily 7 \
--keep-weekly 4 \
--keep-monthly 3

View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
/usr/bin/restic prune

View file

@ -0,0 +1,14 @@
# If you're using sftp with a special key, it's recommended to set an
# alias for the specific host and use it in the repository name
#
# ~/.ssh/config
# Host restic-mybackup
# HostName 192.168.1.2
# Port 22
# User backup
# IdentityFile ~/.ssh/backup
RESTIC_CACHE_DIR="..."
RESTIC_PASSWORD="..."
#RESTIC_REPOSITORY="sftp://restic-mybackup//my/remote/path"
RESTIC_REPOSITORY="..."

View file

@ -0,0 +1,3 @@
/home/lost+found
/home/**/.cache
*.bak/**

View file

@ -0,0 +1,2 @@
/home/myuser
/etc