Browse Source

Sample files for triggering borgmatic from a systemd timer.

Dan Helfman 9 years ago
parent
commit
49c4f483fd
5 changed files with 40 additions and 4 deletions
  1. 1 0
      NEWS
  2. 25 4
      README.md
  3. 0 0
      sample/cron/borgmatic
  4. 6 0
      sample/systemd/borgmatic.service
  5. 8 0
      sample/systemd/borgmatic.timer

+ 1 - 0
NEWS

@@ -1,6 +1,7 @@
 1.0.3-dev
 
  * #18: Fix for README mention of sample files not included in package.
+ * #22: Sample files for triggering borgmatic from a systemd timer.
  * Added logo.
 
 1.0.3

+ 25 - 4
README.md

@@ -119,12 +119,33 @@ If you'd like to see the available command-line arguments, view the help:
 ## Autopilot
 
 If you want to run borgmatic automatically, say once a day, the you can
-configure a job runner like cron to invoke it periodically. Download the
-[sample cron
-file](https://torsion.org/hg/borgmatic/raw-file/tip/sample/borgmatic.cron).
+configure a job runner to invoke it periodically.
+
+### cron
+
+If you're using cron, download the [sample cron
+file](https://torsion.org/hg/borgmatic/raw-file/tip/sample/cron/borgmatic).
 Then, from the directory where you downloaded it:
 
-    sudo cp borgmatic.cron /etc/cron.d/borgmatic
+    sudo mv borgmatic /etc/cron.d/borgmatic
+
+You can modify the cron file if you'd like to run borgmatic more or less frequently.
+
+### systemd
+
+If you're using systemd instead of cron to run jobs, download the [sample
+systemd service
+file](https://torsion.org/hg/borgmatic/raw-file/tip/sample/systemd/borgmatic.service)
+and the [sample systemd timer
+file](https://torsion.org/hg/borgmatic/raw-file/tip/sample/systemd/borgmatic.timer).
+Then, from the directory where you downloaded them:
+
+    sudo mv {borgmatic.service,borgmatic.timer} /etc/systemd/system/
+    sudo systemctl enable borgmatic.timer
+    sudo systemctl start borgmatic.timer
+
+Feel free to modify the timer file based on how frequently you'd like
+borgmatic to run.
 
 
 ## Running tests

+ 0 - 0
sample/borgmatic.cron → sample/cron/borgmatic


+ 6 - 0
sample/systemd/borgmatic.service

@@ -0,0 +1,6 @@
+[Unit]
+Description=borgmatic backup
+
+[Service]
+Type=oneshot
+ExecStart=/usr/local/bin/borgmatic

+ 8 - 0
sample/systemd/borgmatic.timer

@@ -0,0 +1,8 @@
+[Unit]
+Description=Run borgmatic backup
+
+[Timer]
+OnCalendar=daily
+
+[Install]
+WantedBy=timers.target