summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--Makefile4
-rw-r--r--backup@.service.in8
-rw-r--r--backup@.timer.in10
4 files changed, 23 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index e0a3b50..08432d6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,6 @@
backup
+backup@.service
+backup@.timer
backupStatistics
fastRepair
lastBackups
diff --git a/Makefile b/Makefile
index 2b38491..7c08c7c 100644
--- a/Makefile
+++ b/Makefile
@@ -23,11 +23,12 @@ SHELL = /bin/bash
DESTDIR =
ETCDIR = /etc
BINDIR = /usr/bin
+LIBDIR = /usr/lib
MANDIR = /usr/share/man
VERSION = 1.3.1
-all: man.commons backup backup.1 backupStatistics backupStatistics.1 lastBackups lastBackups.1 removeOldBackups removeOldBackups.1
+all: man.commons backup backup.1 backup@.service backup@.timer backupStatistics backupStatistics.1 lastBackups lastBackups.1 removeOldBackups removeOldBackups.1
%: %.in
sed " \
@@ -47,6 +48,7 @@ all: man.commons backup backup.1 backupStatistics backupStatistics.1 lastBackups
install: all
install -D -m0755 -t $(DESTDIR)$(BINDIR) backup backupStatistics lastBackups removeOldBackups
+ install -D -m0644 -t $(DESTDIR)$(LIBDIR)/systemd/system backup@.service backup@.timer
install -D -m0644 -t $(DESTDIR)$(MANDIR)/man1 backup.1 backupStatistics.1 lastBackups.1 removeOldBackups.1
install -D -m0644 -t $(DESTDIR)$(ETCDIR) backup.conf
diff --git a/backup@.service.in b/backup@.service.in
new file mode 100644
index 0000000..c2410ac
--- /dev/null
+++ b/backup@.service.in
@@ -0,0 +1,8 @@
+[Unit]
+Description=Backup %I.
+Requires=network-online.target local-fs.target
+After=network-online.target local-fs.target
+
+[Service]
+Type=simple
+ExecStart=#BINDIR#/backup %I
diff --git a/backup@.timer.in b/backup@.timer.in
new file mode 100644
index 0000000..2056876
--- /dev/null
+++ b/backup@.timer.in
@@ -0,0 +1,10 @@
+[Unit]
+Description=Periodically backup %I.
+
+[Timer]
+AccuracySec=1us
+RandomizedDelaySec=10min
+OnCalendar=*-*-* *:00/10:00
+
+[Install]
+WantedBy=timers.target