From 8d7edc72eee7b54f82e2a228186b8d47503b26fa Mon Sep 17 00:00:00 2001 From: KoenDR06 Date: Sat, 19 Oct 2024 23:38:18 +0200 Subject: [PATCH] Added a backup script and timer --- machines/solis/configuration.nix | 18 ++++++++++++++++++ misc/backup.sh | 5 +++++ 2 files changed, 23 insertions(+) create mode 100644 misc/backup.sh diff --git a/machines/solis/configuration.nix b/machines/solis/configuration.nix index 499c9a0..1fd28f4 100644 --- a/machines/solis/configuration.nix +++ b/machines/solis/configuration.nix @@ -29,6 +29,24 @@ services.resolved.enable = true; services.resolved.extraConfig = "DNSStubListener=no\n"; + systemd.timers."backupSyncthing" = { + wantedBy = [ "timers.target" ]; + timerConfig = { + OnCalendar = "daily"; + Persistent = true; + }; + }; + + systemd.services."backupSyncthing" = { + script = '' + /home/horseman/nix-config/misc/backup.sh + ''; + serviceConfig = { + Type = "oneshot"; + User = "root"; + }; + }; + services.samba = { enable = false; securityType = "user"; diff --git a/misc/backup.sh b/misc/backup.sh new file mode 100644 index 0000000..4d0c446 --- /dev/null +++ b/misc/backup.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +cd /home/horseman + +tar -cf backups/$(date +%Y-%m-%d).tar Documents