From 72fd791e366c1ee38d7fa888b1dc514da9fa3f8f Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Thu, 25 May 2023 04:47:11 -0700 Subject: [PATCH] Added systemd units --- systemd/copy-keepassxc-db@.service | 7 +++++++ systemd/copy-keepassxc-db@.timer | 11 +++++++++++ systemd/vdirsyncer@.service | 9 +++++++++ systemd/vdirsyncer@.timer | 12 ++++++++++++ 4 files changed, 39 insertions(+) create mode 100644 systemd/copy-keepassxc-db@.service create mode 100644 systemd/copy-keepassxc-db@.timer create mode 100644 systemd/vdirsyncer@.service create mode 100644 systemd/vdirsyncer@.timer diff --git a/systemd/copy-keepassxc-db@.service b/systemd/copy-keepassxc-db@.service new file mode 100644 index 0000000..adf5688 --- /dev/null +++ b/systemd/copy-keepassxc-db@.service @@ -0,0 +1,7 @@ +[Unit] +Description=Copy KeePassXC database file to Nextcloud for backup +Wants=default.target + +[Service] +Type=oneshot +ExecStart=/home/zander/scripts/backup-keepassxc-db.sh %i diff --git a/systemd/copy-keepassxc-db@.timer b/systemd/copy-keepassxc-db@.timer new file mode 100644 index 0000000..0ce1414 --- /dev/null +++ b/systemd/copy-keepassxc-db@.timer @@ -0,0 +1,11 @@ +[Unit] +Description=Copy KeePassXC database file to Nextcloud for backup timer + +[Timer] +OnCalendar=daily +AccuracySec=10m +OnStartupSec=5m +Persistent=yes + +[Install] +WantedBy=default.target diff --git a/systemd/vdirsyncer@.service b/systemd/vdirsyncer@.service new file mode 100644 index 0000000..3732007 --- /dev/null +++ b/systemd/vdirsyncer@.service @@ -0,0 +1,9 @@ +[Unit] +Description=Sync calendar %i with vdirsyncer +Wants=default.target + +[Service] +Type=simple +ExecStart=sh -c "echo '%i' | sed 's#:#/#g' | xargs vdirsyncer sync" +RuntimeMaxSec=3m +Restart=on-failure diff --git a/systemd/vdirsyncer@.timer b/systemd/vdirsyncer@.timer new file mode 100644 index 0000000..d7409ec --- /dev/null +++ b/systemd/vdirsyncer@.timer @@ -0,0 +1,12 @@ +[Unit] +Description=Sync calendar %i every 5 minutes with vdirsyncer + +[Timer] +OnCalendar=*-*-* *:5/10:00 +FixedRandomDelay=true +AccuracySec=30s +RandomizedDelaySec=2.5m +Persistent=yes + +[Install] +WantedBy=default.target