aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Singleton <matt@xcolour.net>2022-09-29 20:04:55 -0500
committerMatt Singleton <matt@xcolour.net>2022-09-29 20:04:55 -0500
commite8f79e5a8b7c076b6aed925279a1ebb01bcc20e8 (patch)
tree19f60d74c6cd56ba6f78cefce10863007132a3ce
parent29f7bf92edf6031f8d40928514b9408cd3ec610f (diff)
add systemd user services for backup
-rwxr-xr-xdeploy.sh14
-rw-r--r--systemd/backup.service7
-rw-r--r--systemd/backup.timer9
3 files changed, 27 insertions, 3 deletions
diff --git a/deploy.sh b/deploy.sh
index 81b4989..e4e8134 100755
--- a/deploy.sh
+++ b/deploy.sh
@@ -26,8 +26,9 @@ xdata="${XDG_DATA_HOME:-${HOME}/.local/share}"
xconfig="${XDG_CONFIG_HOME:-${HOME}/.config}"
userbin="$HOME/.local/bin"
+systemd="$xconfig/systemd/user"
-mkdir -p "$xcache" "$xdata" "$xconfig" "$userbin"
+mkdir -p "$xcache" "$xdata" "$xconfig" "$userbin" "$systemd"
function link {
src="$1"
@@ -59,8 +60,7 @@ do
done
cd ..
-# deploy to user binaries
-mkdir -p "$userbin"
+# deploy user executables
cd bin
for f in *
do
@@ -68,6 +68,14 @@ do
done
cd ..
+# deploy systemd user units
+cd systemd
+for f in *
+do
+ link "$(pwd)/${f}" "$systemd/${f}"
+done
+cd ..
+
autoload="$HOME/.vim/autoload"
mkdir -p "$autoload"
# install vim-plug
diff --git a/systemd/backup.service b/systemd/backup.service
new file mode 100644
index 0000000..c1adfde
--- /dev/null
+++ b/systemd/backup.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=Backup with duplicity
+After=network.target
+
+[Service]
+Type=oneshot
+ExecStart=bash ${HOME}/.local/bin/backup
diff --git a/systemd/backup.timer b/systemd/backup.timer
new file mode 100644
index 0000000..b7815d6
--- /dev/null
+++ b/systemd/backup.timer
@@ -0,0 +1,9 @@
+[Unit]
+Description=Run backup every four hours
+
+[Timer]
+OnCalendar=*-*-* 0/4:15
+Persistent=true
+
+[Install]
+WantedBy=timers.target