From e8f79e5a8b7c076b6aed925279a1ebb01bcc20e8 Mon Sep 17 00:00:00 2001 From: Matt Singleton Date: Thu, 29 Sep 2022 20:04:55 -0500 Subject: add systemd user services for backup --- deploy.sh | 14 +++++++++++--- systemd/backup.service | 7 +++++++ systemd/backup.timer | 9 +++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 systemd/backup.service create mode 100644 systemd/backup.timer 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 -- cgit v1.2.3